Repository navigation
Conversation
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.
Rationale for this change
I was looking through
ChunkedArray::Sliceand noticed that it scans chunks from the beginning to find the chunk containing the requested offset. For arrays with many chunks, this can mean checking many chunks when a slice starts later in the array.This change uses the existing chunk resolver to find the starting chunk directly, reducing the lookup work for those cases.
What changes are included in this PR?
ChunkResolverto locate the starting chunk for non-negative slice offsets.Are these changes tested?
The Release build completed, and all 40 C++ unit-test executables registered in this build passed. The affected
arrow-table-testpassed all 212 tests, including the new empty-chunk test.The benchmark compares a benchmark-local reproduction of the previous linear lookup with the current implementation in the same executable. It uses arrays with 4,096 or 16,384 chunks, each containing 8 values, and measures one-element slices at fixed or varying offsets. Each case ran for at least 100 ms per repetition, with nine repetitions and random interleaving. The table shows median CPU time per call.
Benchmark machine and build: Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, 12th Gen Intel Core i5-1235U (12 logical CPUs), 14 GiB RAM, GCC 15.2, Release build.
Slices starting at offset zero showed essentially no difference. These are local microbenchmark results using small, fixed-size chunks; the gains are most evident for later or varying offsets in arrays with many chunks and should not be read as a general speedup for every workload.
The test run covers the C++ unit-test executables enabled in this build, not optional C++ components or other Arrow language implementations.
Are there any user-facing changes?
No public API or intended behavior changes. This is an internal performance change.
Was AI used for this PR?
AI assistance was used to implement and review the code, test, and benchmark, and to draft this description.
PR code and description written by:
Reviewed before submission by: