hhhizzz commented on PR #10397: URL: https://github.com/apache/arrow-rs/pull/10397#issuecomment-5030552974
> Interestingly, I couldn't find any benchmark improvements > > * [Add benchmark for `BooleanArray::take_n_true` #10399](https://github.com/apache/arrow-rs/pull/10399) I ran additional `take_n_true` benchmarks on my server using five alternating rounds pinned to a single CPU. The current implementation was approximately 42–45% slower than `main` on the existing 8K-bit benchmarks. I then tested a large-buffer fast path that reuses the existing allocation only when: - the retained prefix is at least 64 KiB; - the BooleanBuffer is unsliced; and - the allocation is uniquely owned. This avoids allocating a new buffer and copying a large retained prefix. It produced significant improvements: - 1M bits, 50% cutoff: 24.15% faster - 1M bits, 99% cutoff: 25.50% faster - 16M bits, 50% cutoff: 27.30% faster - 16M bits, 99% cutoff: 30.26% faster However, adding this dispatch to `take_n_true` still caused a repeatable 2.7–4.7% regression on the existing 8K workload due to changes in generated code, even though that workload did not enter the reuse path. The large-buffer reuse optimization is promising, but I suggest investigating it separately so the existing small-input `take_n_true` path remains unchanged. -- 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]
