From e6d898c525ceef3e243bb9d57ebcd82364651496 Mon Sep 17 00:00:00 2001 From: chloro <13125187405@163.com> Date: Sun, 28 Jul 2024 09:28:20 +0800 Subject: [PATCH] add filter benchmark for fsb --- arrow/benches/filter_kernels.rs | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/arrow/benches/filter_kernels.rs b/arrow/benches/filter_kernels.rs index e48b5302241d..ae5eec386eb4 100644 --- a/arrow/benches/filter_kernels.rs +++ b/arrow/benches/filter_kernels.rs @@ -204,6 +204,49 @@ fn add_benchmark(c: &mut Criterion) { |b| b.iter(|| bench_built_filter(&sparse_filter, &data_array)), ); + let mut add_benchmark_for_fsb_with_length = |value_length: usize| { + let data_array = create_fsb_array(size, 0.0, value_length); + c.bench_function( + format!("filter fsb with value length {value_length} (kept 1/2)").as_str(), + |b| b.iter(|| bench_filter(&data_array, &filter_array)), + ); + c.bench_function( + format!( + "filter fsb with value length {value_length} high selectivity (kept 1023/1024)" + ) + .as_str(), + |b| b.iter(|| bench_filter(&data_array, &dense_filter_array)), + ); + c.bench_function( + format!("filter fsb with value length {value_length} low selectivity (kept 1/1024)") + .as_str(), + |b| b.iter(|| bench_filter(&data_array, &sparse_filter_array)), + ); + + c.bench_function( + format!("filter context fsb with value length {value_length} (kept 1/2)").as_str(), + |b| b.iter(|| bench_built_filter(&filter, &filter_array)), + ); + c.bench_function( + format!( + "filter context fsb with value length {value_length} high selectivity (kept 1023/1024)" + ) + .as_str(), + |b| b.iter(|| bench_built_filter(&filter, &dense_filter_array)), + ); + c.bench_function( + format!( + "filter context fsb with value length {value_length} low selectivity (kept 1/1024)" + ) + .as_str(), + |b| b.iter(|| bench_built_filter(&filter, &sparse_filter_array)), + ); + }; + + add_benchmark_for_fsb_with_length(5); + add_benchmark_for_fsb_with_length(20); + add_benchmark_for_fsb_with_length(50); + let data_array = create_primitive_array::(size, 0.0); let field = Field::new("c1", data_array.data_type().clone(), true);