PERF: build read_csv pyarrow string columns without the GIL, deferring the wrap#66277
Draft
jbrockmendel wants to merge 1 commit into
Draft
PERF: build read_csv pyarrow string columns without the GIL, deferring the wrap#66277jbrockmendel wants to merge 1 commit into
jbrockmendel wants to merge 1 commit into
Conversation
f6f4268 to
a094c1b
Compare
a094c1b to
876858d
Compare
…g the wrap _string_pyarrow_utf8 now mallocs offsets/validity/data inside a single nogil region and returns a raw handle; materialization into a pyarrow Array (via capsule-backed foreign buffers) happens once per column at the end of the read, and low_memory chunks combine zero-copy into one chunked ExtensionArray. Also caches the pyarrow helper imports and the per-reader string-target decision, which previously re-ran option lookups per column chunk while holding the GIL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
876858d to
40fd58c
Compare
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.
Follow-up to GH-65283.
_string_pyarrow_utf8now mallocs offsets/validity/data inside a single nogil region and returns a raw pending-column handle; materialization into a pyarrow Array (via capsule-backed foreign buffers) happens once per column at the end of the read, andlow_memorychunks combine zero-copy into one chunked ExtensionArray. Also caches the pyarrow helper imports and the per-reader string-target decision, which previously re-ran option lookups per column chunk while holding the GIL.Draft, sequenced after GH-66275: standalone this is neutral on today's serial and parallel paths (the GIL sections it removes are not the bottleneck there); on that PR's reworked parallel path it is a large win — str 86.2 → 64.4 ms (−25%). Will convert to ready once GH-66275 lands and re-verify on the rebase (a 3-line follow-up there lets workers hand raw pending columns to the gather for main-thread materialization).
🤖 Generated with Claude Code