viirya commented on code in PR #12024:
URL: https://github.com/apache/arrow-rs/pull/12024#discussion_r4444509072
##########
arrow-buffer/src/builder/boolean.rs:
##########
@@ -276,9 +276,31 @@ impl BooleanBufferBuilder {
self.advance(additional);
let offset = self.len() - additional;
- for (i, v) in slice.iter().enumerate() {
+ let buffer = self.buffer.as_slice_mut();
+
+ // Set bits individually until the write position is byte aligned
+ let head = ((8 - offset % 8) % 8).min(additional);
Review Comment:
Thanks, I reproduced this on Apple M-series too. With a new `append_slice
short` bench (7168 appends of 1–7 values starting at bit offset 3), random went
from 22.8 to 31.0 µs and all-false from 19.7 to 31.7 µs. A scalar loop for `len
< 8` on its own only recovered part of it (~24 / ~26 µs). In fae73df5a I kept
the original per-bit loop for `len < 8` and moved the packing path into an
`#[inline(never)]` helper. That gives 20.0 / 18.6 µs, slightly faster than
main, and the 64Ki cases are unchanged (~1.2 µs vs 75–165 µs on main). The
short-append case is now part of the `boolean_buffer_builder` bench.
--
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]