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 22:11:03 UTC

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

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



##########
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:
       Yes, would be nice to see if we can get the combination of a clean/safe API and good performance as well.




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