arrow
arrow copied to clipboard
[C++][Compute] Investigate prefix-aware early rejection for StringView equality kernels
Describe the enhancement requested
In #55171 (GH-54668), direct comparison kernels were added between StringView/BinaryView and standard offset-based string types.
As noted by @dmitry-chirkov-dremio in PR review, equality comparisons (equal, not_equal) can leverage the 4-byte inline prefix in the view descriptor to reject mismatches without dereferencing variadic payload buffers (yielding ~1.8x–2x speedups on workloads with ~50% early mismatches).
Currently, these kernels execute via applicator::ScalarBinary with ArrayIterator<BinaryViewType>, which eagerly calls util::FromBinaryView and dereferences payload buffers for all strings > 12 bytes upfront before comparison logic runs.
This issue tracks:
- Prefix-aware fast paths:
- View vs. View: Compare combined 64-bit
(length, prefix)before accessing variadic buffers (leveragingutil::EqualBinaryViewor vectorized loops). - View vs. String: Check length and match the view's 4-byte prefix against the offset string's buffer without dereferencing the view's payload buffer.
- Bypassing eager
ArrayIteratorresolution (e.g. via dedicated vectorized loops writing bit-packed booleans).
- View vs. View: Compare combined 64-bit
- Benchmarking & heuristics:
- Benchmark across mismatch distributions (0% mismatch, ~50% early mismatch, 100% prefix collision).
- Explore adaptive heuristics (such as batch sampling) to ensure prefix checks don't add net overhead when strings match.
Component(s)
C++, Compute