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


##########
arrow-select/src/nullif.rs:
##########
@@ -72,40 +71,20 @@ pub fn nullif(left: &dyn Array, right: &BooleanArray) -> 
Result<ArrayRef, ArrowE
 
     // Compute left null bitmap & !right
 
-    let (combined, null_count) = match left_data.nulls() {
-        Some(left) => {
-            let mut valid_count = 0;
-            let b = bitwise_bin_op_helper(
-                left.buffer(),
-                left.offset(),
-                right.inner(),
-                right.offset(),
-                len,
-                |l, r| {
-                    let t = l & !r;
-                    valid_count += t.count_ones() as usize;
-                    t
-                },
-            );
-            (b, len - valid_count)
-        }
-        None => {
-            let mut null_count = 0;
-            let buffer =
-                BooleanBuffer::from_bitwise_unary_op(right.inner(), 
right.offset(), len, |b| {
-                    let t = !b;
-                    null_count += t.count_zeros() as usize;
-                    t
-                })
-                .into_inner();
-            (buffer, null_count)
-        }
+    let combined = if let Some(left) = left_data.nulls() {

Review Comment:
   Note to self: I made a nullif benchmark locally, and it seems as if counting 
bits during the application actually does make a small difference
   
   ```
   nullif no-nulls mask(10%)
                           time:   [208.47 ns 209.97 ns 211.22 ns]
                           change: [+6.4142% +7.1611% +7.9491%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 11 outliers among 100 measurements (11.00%)
     6 (6.00%) low severe
     2 (2.00%) low mild
     2 (2.00%) high mild
     1 (1.00%) high severe
   
   nullif no-nulls mask(10%, sliced)
                           time:   [242.71 ns 244.30 ns 245.68 ns]
                           change: [+4.9678% +5.8756% +6.8006%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 9 outliers among 100 measurements (9.00%)
     6 (6.00%) low severe
     3 (3.00%) low mild
   
   nullif no-nulls mask(1%)
                           time:   [220.58 ns 222.91 ns 225.16 ns]
                           change: [+10.834% +12.034% +13.361%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 10 outliers among 100 measurements (10.00%)
     7 (7.00%) low severe
     2 (2.00%) low mild
     1 (1.00%) high severe
   
   nullif nulls mask(10%)  time:   [213.91 ns 215.16 ns 216.23 ns]
                           change: [+4.9421% +5.7045% +6.4951%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 10 outliers among 100 measurements (10.00%)
     4 (4.00%) low severe
     6 (6.00%) low mild
   
   nullif nulls mask(10%, sliced)
                           time:   [253.58 ns 255.72 ns 257.57 ns]
                           change: [+3.2081% +4.1105% +4.9077%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 10 outliers among 100 measurements (10.00%)
     6 (6.00%) low severe
     4 (4.00%) low mild
   
   nullif nulls mask(1%)   time:   [224.66 ns 226.45 ns 227.95 ns]
                           change: [+7.8770% +8.8461% +9.8628%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   Found 12 outliers among 100 measurements (12.00%)
     7 (7.00%) low severe
     5 (5.00%) low mild
   ```



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