azecevic000 opened a new issue, #12269: URL: https://github.com/apache/arrow-rs/issues/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 -- 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]
