alamb commented on code in PR #8807:
URL: https://github.com/apache/arrow-rs/pull/8807#discussion_r2503902196


##########
arrow-buffer/src/buffer/ops.rs:
##########
@@ -71,6 +71,30 @@ pub fn bitwise_bin_op_helper<F>(
 where
     F: FnMut(u64, u64) -> u64,
 {
+    // If the underlying buffers are aligned to u64 we can apply the operation 
directly on the u64 slices
+    // to improve performance.
+    if left_offset_in_bits == 0 && right_offset_in_bits == 0 {
+        unsafe {
+            let (left_prefix, left_u64s, left_suffix) = 
left.as_slice().align_to::<u64>();
+            let (right_prefix, right_u64s, right_suffix) = 
right.as_slice().align_to::<u64>();
+            // if there is no prefix or suffix, both buffers are aligned and 
we can do the operation directly
+            // on u64s
+            // TODO also handle non empty suffixes by processing them 
separately
+            if left_prefix.is_empty()
+                && right_prefix.is_empty()
+                && left_suffix.is_empty()
+                && right_suffix.is_empty()
+            {
+                let result_u64s = left_u64s

Review Comment:
   I am pretty excited to see how much this actually helps with performance. 
This code should vectorize pretty spectacularly



-- 
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]

Reply via email to