You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
arrow-buffer: ops on empty buffer values slow on x86-64 with AVX-512 #12269
Is your feature request related to a problem or challenge?
When all values of a string or binary array are empty, its values buffer has no allocation. Its pointer is then a dangling address in the unmapped first page: 0x80 (ALIGNMENT on x86-64) for a MutableBuffer, or 0x1 for a buffer from an empty Vec<u8>.
glibc >=2.35 use __memcmp_evex_movbe as a memcmp implementation on x86 AVX-512 machine. For lengths <=32, it uses masked vector loads, with no branch for length 0. Even though the result is correct, the CPU still translates the address. On the machine on which I measured the diff is ~90ns without the fix vs ~2ns with the fix.
Describe the solution you'd like
Give all buffers without an allocation one real, aligned static address, as Arrow C++ does with zero_size_area. This is fairly common technique which guards against UB like the one just described.
Describe alternatives you've considered
Fix individual ops like eq, lt etc. There are many of them, and it's hard to get a proper coverage.
Fix in either rustc and glibc. This can be considered an issue in both of those projects, but the proposed solution is still valuable regardless of a potential fix in either of those dependencies.
Additional context
No response
Willingness to contribute
I plan to contribute to this feature independently
Activity
azecevic000 commentedon Nov 16, 2026
proposed solution: #12141
Add all-empty string case to the parquet arrow_writer benchmark (apac…
perf(arrow-buffer): use a static address for buffers without an alloc…