You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/05 19:17:26 UTC

[GitHub] [arrow] jorgecarleitao commented on a change in pull request #8837: ARROW-10810: [Rust] Speed up comparison kernels

jorgecarleitao commented on a change in pull request #8837:
URL: https://github.com/apache/arrow/pull/8837#discussion_r536875918



##########
File path: rust/arrow/src/compute/kernels/comparison.rs
##########
@@ -68,9 +77,18 @@ macro_rules! compare_op {
 macro_rules! compare_op_scalar {
     ($left: expr, $right:expr, $op:expr) => {{
         let null_bit_buffer = $left.data().null_buffer().cloned();
-        let mut result = BooleanBufferBuilder::new($left.len());
+        let byte_capacity = bit_util::ceil($left.len(), 8);
+        let actual_capacity = bit_util::round_upto_multiple_of_64(byte_capacity);
+        let mut buffer = MutableBuffer::new(actual_capacity);
+        buffer.resize(byte_capacity);
+
+        let data = buffer.raw_data_mut();
         for i in 0..$left.len() {
-            result.append($op($left.value(i), $right))?;
+            if $op($left.value(i), $right) {
+                unsafe {
+                    bit_util::set_bit_raw(data, i);
+                }
+            }

Review comment:
       A side note: In general, if we are bypassing builders for speed, it can mean that builders are not a good abstraction, as they significantly impact performance.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org