bvolpato opened a new issue, #55730: URL: https://github.com/apache/arrow/issues/55730
### Describe the enhancement requested `PrimitiveFilterImpl::Exec()` in `cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc` currently leaves significant performance on the table at medium selectivity (~50%) and whenever the data or filter array has nulls: - When neither array has nulls, `VisitSetBitRunsVoid` produces very short 1 to 2 element runs at ~50% selectivity, leading to tens of thousands of tiny `memcpy` calls and mispredicted run loops. - Whenever data or filter nulls are present, the kernel falls back to per-element `GetBit` branches and per-bit read-modify-write `SetBit` calls. Processing filter and validity bitmaps 64 bits at a time via `BitmapWordReader<uint64_t>` with branchless compaction for fixed-width primitives (1, 2, 4, 8, and 16-byte values), sparse `std::countr_zero` iteration for low-popcount and tail blocks, register-level bitmap compaction for validity/boolean outputs, and preserving `VisitSetBitRunsVoid` at >93.75% no-null selectivity speeds up `FilterInt64` by 4.15x to 9.13x at 50% selectivity and 3.36x at 99.9% selectivity with filter nulls without regressing the 99.9% no-null path. ### 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]
