Repository navigation
Separate clean and dirty DataFrame handling without virtual dispatch - #335
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #335 +/- ##
==========================================
- Coverage 91.60% 91.59% -0.02%
==========================================
Files 55 61 +6
Lines 3574 3770 +196
Branches 1058 1097 +39
==========================================
+ Hits 3274 3453 +179
+ Misses 115 110 -5
- Partials 185 207 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
DataFramecode was becoming unmaintainable as evidenced by the issues discovered in #332 and #333.DataFramewas forced to deal with both clean and edited data frame concerns and had grown to >1000 LOC.This architecture centralizes clean/dirty state handling, without imposing the overhead of virtual function dispatch.
Bonus: A
DataFrameColumnrefactor where we grab the raw string view fromCSVRowinstead of going throughCSVFieldhas sped upchunk_parallel_apply()column scanning operations by 25% in our preliminary benchmarks.Full Details
DataFrame delegates storage behavior to internal CleanDataFrame and DirtyDataFrame classes while preserving its public API and C++11 compatibility. DirtyDataFrame owns edit overlays, visible column names, column mapping, and structural column insertion. A stable storage controller selects the concrete backend through an atomic tagged pointer and direct calls, with no virtual dispatch.
The first edit publishes a fully initialized dirty backend while retaining parsed storage, so existing row and cell proxies observe edits safely. Materialization returns to clean storage, selection snapshots edits independently, and stored keys—including string_view keys—retain their values and backing bytes across structural changes.
Read-only column views now extract decoded, trimmed field bytes directly through CSVRow's existing internal routine, avoiding CSVField construction and scalar metadata retrieval. Dirty overlays retain their existing lookup and locking. This adds no public API or object-layout change. Paired MSVC measurements showed about 25% less elapsed time for the full chunk_parallel_apply pipeline in both compiled-library and generated-header builds; a four-pair check of the integrated implementation reproduced that reduction.
The retained investigation includes methodology, raw data, reproduction instructions, and the rejected physical-column caching alternative. Standalone benchmark tools live outside the amalgamation input tree.
Fixes #333. Focused regressions in tests/test_data_frame_dirty.cpp exercise mmap and stream inputs, backend transitions, captured proxies, concurrent first edits, schema mapping, zero-column rows, selection, key preservation, and direct-view equivalence for quoted/trimmed/materialized fields.
Validation of the latest commit:
Cross-platform CI runs on the updated PR commit; the preceding backend-refactor commit passed the full platform matrix including Linux C++11. Performance percentages are measurements from the documented MSVC/processor setup.