Dandandan commented on code in PR #9297:
URL: https://github.com/apache/arrow-rs/pull/9297#discussion_r2770944931
##########
arrow-buffer/src/buffer/boolean.rs:
##########
@@ -191,67 +192,34 @@ impl BooleanBuffer {
where
F: FnMut(u64) -> u64,
{
- // try fast path for aligned input
+ let aligned_start = &src.as_ref()[offset_in_bits / 8..];
+
if offset_in_bits & 0x7 == 0 {
- // align to byte boundary
- let aligned = &src.as_ref()[offset_in_bits / 8..];
- if let Some(result) =
- Self::try_from_aligned_bitwise_unary_op(aligned, len_in_bits,
&mut op)
- {
- return result;
+ let (prefix, aligned_u64s, suffix) =
+ unsafe { aligned_start.as_ref().align_to::<u64>() };
+ if prefix.is_empty() && suffix.is_empty() {
Review Comment:
Handle aligned + suffix could maybe be a bit better for x86 (couldn't
measure it on Apple M2 - I believe there is no performance difference).
Handling both prefix + suffix was a slightly slower than the unaligned
version.
--
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]