Repository navigation
Conversation
A string column copies every cell longer than the inline payload into a buffer the chunk owns. That buffer grew one reallocation at a time, and under parallel parsing the copies and the page faults of each new block dominated: on a 163 MB file of text columns, 65% of the 8-task parse wave sat on the resize. At its first long cell the loop now reserves the span bytes of the column's remaining long cells (an upper bound on what it can copy), so the buffer is allocated once. Columns of inline-length cells pay nothing. The finished column also stops retaining growth slack. strings.csv (163 MB, 1.2M rows x 10 text columns), interleaved runs: 8 tasks 0.20 -> 0.14 s, total CPU 0.62-0.71 -> 0.36-0.61 s; 1 task peak RSS 959-994 -> 841 MB; retained string-buffer capacity 146 -> 106 MiB for 106 MiB of bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1220 +/- ##
==========================================
+ Coverage 95.79% 95.81% +0.01%
==========================================
Files 9 9
Lines 5566 5591 +25
==========================================
+ Hits 5332 5357 +25
Misses 234 234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The reservation counts every cell span longer than the inline payload, but a quoted 12-byte value, a short escaped value, a long sentinel, or a padded cell under stripwhitespace copies nothing, and the finished column kept the unused capacity: one million quoted phone numbers retained 13.8 MB for 9,500 bytes. After the loop the buffer shrinks to what it holds when the slack exceeds half its size and 64 KiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
String columns copy every cell longer than the 12-byte inline payload into a buffer the chunk owns. That buffer grew by one
resize!per cell, reallocating as it went. With several tasks the reallocation copies and the page faults of each new block dominated the parse: in an 8-task profile of a text-heavy file, 65% of the chunk workers' samples sat on thatresize!line.At its first long cell, the loop now sums the field spans of the column's remaining long cells in the chunk (an upper bound on what it can copy, since content never exceeds its span) and reserves that once. Columns whose cells are all inline-length never run the pass. Values are unchanged; only buffer capacity changes. A side effect: finished columns no longer retain the growth slack.
strings.csv(163 MB, 1.2M rows, 10 text columns), interleaved process pairs on a loaded M3 Max, Julia 1.12.6:A mixed file whose text cells are mostly inline-length showed no difference beyond noise.
Review: my own pass, then an independent agent review (values, row coverage, copy bounds,
sizehint!on 1.10/1.12, thread ownership, 40 cases on 1.10 and 1.12 compared with main), which found the over-reservation below.Chunksbatches) goes throughparsecolchunk!(::StringColumn, ...), and each passes a column whose buffer is private to the call. The transposed reader calls_own!on its own and is unchanged.stripwhitespace). A second review found that the finished column kept that slack (one million quoted phone numbers retained 13.8 MB for 9,500 bytes; main 9,873). Fixed in the second commit: after the loop the buffer shrinks to what it holds when the slack exceeds half its size and 64 KiB. Same input now retains 9,500 bytes.sizehint!on a fresh buffer only grows it, on Julia 1.10 and later.Verification:
DataString: owned bytes are reserved at their final size: (1) plain, quoted, and quote-escaped long cells over many chunks, serial and parallel: values, every byte owned once, and a capacity bound that main fails (328,601 bytes retained against a 208,728 bound); (2) quoted 12-byte and short escaped values with occasional long ones: a capacity bound that the first commit alone fails (1.40 MB and 1.50 MB against a 70 KB bound). Julia 1.10'ssummarysizeignores capacity, so the bounds only bind on 1.11+.--check-bounds=yes -t4: 331,788 passed (head).🤖 Generated with Claude Code