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 f4f9433343 fix(bug): benchmark inputs not measuring the intended
workload (#11220)
f4f9433343 is described below
commit f4f943334319fee656f75fe219dcc6a8d3af2c49
Author: WeblWabl <[email protected]>
AuthorDate: Fri Sep 25 20:21:40 2026 -0500
fix(bug): benchmark inputs not measuring the intended workload (#11220)
A handful of benchmarks were set up with inputs that did not match what
they claim to measure. This PR fixes the inputs so the numbers actually
reflect the intended workload.
- `buffer_create`: `MutableBuffer iter bitset` allocated 4KiB per buffer
(from the outer vec length) and set the length to `datum.len()` bytes
instead of the bitmap size. Now sized to `datum.len().div_ceil(8)`.
- `interleave_kernels`: `dict_distinct` always used 100 indices
regardless of `len`, so 1024 and 2048 were measuring the same thing.
- `lexsort`: `Optional50CharString` was generated without nulls and one
case was duplicated.
- `take_kernels`: `take list i32 null indices 1024` used lists of 202
elements instead of 20 like the rest of the list benches.
- `arrow_reader_row_filter`: `UnselectiveUnclustered` was missing the
`NOT`, so it was measuring the same ~1% selective filter as
`SelectiveUnclustered` instead of ~99%.
Benchmarks from my machine (i7-12700K), main vs this branch:
| Bench | main | fixed | change |
|---|---|---|---|
| `MutableBuffer iter bitset` | 39.3 ms | 4.38 ms | -89% |
| `interleave dict_distinct 1024` | 1.43 µs | 4.73 µs | +234% |
| `interleave dict_distinct 2048` | 1.33 µs | 2.32 µs | +74% |
| `take list i32 null indices 1024` | 6.29 µs | 2.76 µs | -56% |
| `float64 <= 99.0` row filter (non-limit) | 4.31–5.17 ms | 6.68–8.31 ms
| +53% to +61% |
| `lexsort` cases with `str_opt(50)` | | | -6% to +20% |
---
arrow/benches/buffer_create.rs | 4 ++--
arrow/benches/interleave_kernels.rs | 2 +-
arrow/benches/lexsort.rs | 8 +-------
arrow/benches/take_kernels.rs | 2 +-
parquet/benches/arrow_reader_row_filter.rs | 4 ++--
5 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/arrow/benches/buffer_create.rs b/arrow/benches/buffer_create.rs
index 3ec897baf9..2849d3f320 100644
--- a/arrow/benches/buffer_create.rs
+++ b/arrow/benches/buffer_create.rs
@@ -48,8 +48,8 @@ fn mutable_buffer_iter_bitset(data: &[Vec<bool>]) ->
Vec<Buffer> {
hint::black_box({
data.iter()
.map(|datum| {
- let mut result =
-
MutableBuffer::new(data.len().div_ceil(8)).with_bitset(datum.len(), false);
+ let byte_len = datum.len().div_ceil(8);
+ let mut result =
MutableBuffer::new(byte_len).with_bitset(byte_len, false);
for (i, value) in datum.iter().enumerate() {
if *value {
unsafe {
diff --git a/arrow/benches/interleave_kernels.rs
b/arrow/benches/interleave_kernels.rs
index 310a4557c5..ee5bfb13d9 100644
--- a/arrow/benches/interleave_kernels.rs
+++ b/arrow/benches/interleave_kernels.rs
@@ -212,7 +212,7 @@ fn add_benchmark(c: &mut Criterion) {
bench_values(
c,
&format!("interleave dict_distinct {len}"),
- 100,
+ len,
&[&dict, &sparse_dict],
);
}
diff --git a/arrow/benches/lexsort.rs b/arrow/benches/lexsort.rs
index 7061973fae..9bd42ba861 100644
--- a/arrow/benches/lexsort.rs
+++ b/arrow/benches/lexsort.rs
@@ -71,7 +71,7 @@ impl Column {
Arc::new(create_string_array_with_len::<i32>(size, 0.2, 16))
}
Column::Optional50CharString => {
- Arc::new(create_string_array_with_len::<i32>(size, 0., 50))
+ Arc::new(create_string_array_with_len::<i32>(size, 0.2, 50))
}
Column::Optional100Value50CharStringDict => {
Arc::new(create_dict_from_values::<Int32Type>(
@@ -186,12 +186,6 @@ fn add_benchmark(c: &mut Criterion) {
Column::Optional100Value50CharStringDict,
Column::Optional50CharString,
],
- &[
- Column::Optional100Value50CharStringDict,
- Column::Optional100Value50CharStringDict,
- Column::Optional100Value50CharStringDict,
- Column::Optional50CharString,
- ],
&[Column::OptionalI32, Column::RequiredI32List],
&[Column::OptionalI32, Column::OptionalI32List],
&[Column::OptionalI32List, Column::OptionalI32],
diff --git a/arrow/benches/take_kernels.rs b/arrow/benches/take_kernels.rs
index 2967f65221..e7d7fe97dd 100644
--- a/arrow/benches/take_kernels.rs
+++ b/arrow/benches/take_kernels.rs
@@ -319,7 +319,7 @@ fn add_benchmark(c: &mut Criterion) {
b.iter(|| bench_take(&values, &indices))
});
- let values = create_primitive_list_array::<i32, Int32Type>(1024, 0.0, 0.0,
202);
+ let values = create_primitive_list_array::<i32, Int32Type>(1024, 0.0, 0.0,
20);
let indices = create_random_index(1024, 0.5);
c.bench_function("take list i32 null indices 1024", |b| {
b.iter(|| bench_take(&values, &indices))
diff --git a/parquet/benches/arrow_reader_row_filter.rs
b/parquet/benches/arrow_reader_row_filter.rs
index d34d2eb3d9..db4f475c3c 100644
--- a/parquet/benches/arrow_reader_row_filter.rs
+++ b/parquet/benches/arrow_reader_row_filter.rs
@@ -53,8 +53,8 @@
//!
use arrow::array::{ArrayRef, BooleanArray, Float64Array, Int64Array,
TimestampMillisecondArray};
-use arrow::compute::and;
use arrow::compute::kernels::cmp::{eq, gt, lt, neq};
+use arrow::compute::{and, not};
use arrow::datatypes::{DataType, Field, Schema, TimeUnit};
use arrow::record_batch::RecordBatch;
use arrow_array::StringViewArray;
@@ -382,7 +382,7 @@ impl FilterType {
// Unselective Unclustered on float64 column: NOT (float64 > 99.0)
FilterType::UnselectiveUnclustered => {
let array = batch.column(batch.schema().index_of("float64")?);
- gt(array, &Float64Array::new_scalar(99.0))
+ not(>(array, &Float64Array::new_scalar(99.0))?)
}
// Unselective Clustered on ts column: ts < 9000
FilterType::UnselectiveClustered => {