This is an automated email from the ASF dual-hosted git repository.

Jefffrey pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 0dc1e46c1a Benches: introduce null_expand benchmarks (#10942)
0dc1e46c1a is described below

commit 0dc1e46c1ae96ec94364f93a06a29497781a90f8
Author: RIchard Baah <[email protected]>
AuthorDate: Tue Sep 1 21:33:54 2026 -0400

    Benches: introduce null_expand benchmarks (#10942)
    
    # Which issue does this PR close?
    
    <!--
    We generally require a GitHub issue to be filed for all bug fixes and
    enhancements and this helps us generate change logs for our releases.
    You can link an issue to this PR using the GitHub syntax.
    -->
    
    - Closes works towards #10883.
    
    # Rationale for this change
    
    measure progress towards #10883
    
    <!--
    Why are you proposing this change? If this is already explained clearly
    in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand
    your changes and offer better suggestions for fixes.
    -->
    
    # What changes are included in this PR?
    new benchmarks
    <!--
    There is no need to duplicate the description in the issue here but it
    is sometimes worth providing a summary of the individual changes in this
    PR.
    -->
    
    # Are these changes tested?
    n/a
    <!--
    We typically require tests for all PRs in order to:
    1. Prevent the code from being accidentally broken by subsequent changes
    2. Serve as another way to document the expected behavior of the code
    
    If tests are not included in your PR, please explain why (for example,
    are they covered by existing tests)?
    
    If this PR claims a performance improvement, please include evidence
    such as benchmark results.
    -->
    
    # Are there any user-facing changes?
    no
    <!--
    If there are user-facing changes then we may require documentation to be
    updated before approving the PR.
    
    If there are any breaking changes to public APIs, please call them out.
    -->
---
 arrow/benches/boolean_kernels.rs | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/arrow/benches/boolean_kernels.rs b/arrow/benches/boolean_kernels.rs
index 34181bede5..8319fc282d 100644
--- a/arrow/benches/boolean_kernels.rs
+++ b/arrow/benches/boolean_kernels.rs
@@ -23,6 +23,7 @@ use arrow::util::bench_util::create_boolean_array;
 
 use arrow::array::*;
 use arrow::compute::kernels::boolean as boolean_kernels;
+use arrow_buffer::NullBuffer;
 use std::hint;
 
 fn bench_and(lhs: &BooleanArray, rhs: &BooleanArray) {
@@ -77,5 +78,34 @@ fn add_benchmark(c: &mut Criterion) {
     c.bench_function("not_slice_24", |b| b.iter(|| 
bench_not(&array1_sliced_24)));
 }
 
-criterion_group!(benches, add_benchmark);
+fn make_null_buffer(len: usize) -> NullBuffer {
+    NullBuffer::from(
+        (0..len)
+            .map(|i| (i / 4) % 2 == 0)
+            .collect::<Vec<bool>>()
+            .as_slice(),
+    )
+}
+
+fn bench_null_buffer_expand(c: &mut Criterion) {
+    let mut group = c.benchmark_group("null_buffer_expand");
+
+    let cases: &[(&str, usize, usize)] = &[
+        ("len=512/count=16", 512, 16), // pow2
+        ("len=512/count=12", 512, 12), // non-pow2
+        ("len=1024/count=128", 1024, 128),
+        ("len=1024/count=96", 1024, 96),
+        ("len=2048/count=256", 2048, 256),
+        ("len=2048/count=192", 2048, 192),
+    ];
+
+    for &(label, len, count) in cases {
+        let buf = make_null_buffer(len);
+        group.bench_function(label, |b| b.iter(|| 
hint::black_box(buf.expand(count))));
+    }
+
+    group.finish();
+}
+
+criterion_group!(benches, add_benchmark, bench_null_buffer_expand);
 criterion_main!(benches);

Reply via email to