Sumdiboii opened a new issue, #55741: URL: https://github.com/apache/arrow/issues/55741
### Describe the enhancement requested I was looking through ChunkedArray::Slice and noticed that it scans chunks from the beginning to find the chunk containing the requested offset. For arrays with many chunks, that can mean checking a lot of chunks when the slice starts later in the array. I changed the starting-chunk lookup to use the existing chunk resolver and added a test for slices when empty chunks are present. The Release build completed, and all 40 C++ unit-test executables registered in this build passed. The affected arrow-table-test passed all 212 tests, including the new empty-chunk test. I also benchmarked the previous linear lookup against the resolver-based implementation in the same executable. The previous lookup is reproduced there as a benchmark reference. The benchmark uses arrays with 4,096 or 16,384 chunks, each containing 8 values, and measures one-element slices at fixed or varying offsets. It was built in Release mode with GCC 15.2. Each case ran for at least 100 ms per repetition; I used nine repetitions with random interleaving and report median CPU time per call. Machine: Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, 12th Gen Intel Core i5-1235U (12 logical CPUs), 14 GiB RAM. | Chunks | Slice start | Previous lookup | Resolver lookup | Speedup | | ---: | --- | ---: | ---: | ---: | | 4,096 | Middle | 1,711 ns | 84.4 ns | 20.3× | | 4,096 | Near end | 3,633 ns | 82.1 ns | 44.3× | | 4,096 | Varying offsets | 1,756 ns | 129 ns | 13.6× | | 16,384 | Middle | 26,974 ns | 82.1 ns | 328.5× | | 16,384 | Near end | 62,546 ns | 80.9 ns | 772.9× | | 16,384 | Varying offsets | 28,681 ns | 195 ns | 147.2× | Slices starting at offset zero showed essentially no difference. These are local microbenchmark results with small, fixed-size chunks; the improvement is most evident for later or varying offsets in arrays with many chunks, and should not be taken as a general speedup for every workload. This covers the C++ unit-test executables enabled in this build, not every Arrow test across optional C++ components or other languages. I’d appreciate any corrections if I’ve missed an important detail or left out useful context. ### Component(s) C++ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
