From 9a6fd8139b136cb19d03046b323a89b080fa5025 Mon Sep 17 00:00:00 2001 From: RinChanNOWWW Date: Sun, 14 Apr 2024 10:11:56 +0800 Subject: [PATCH] Add string view filter benchmark. --- arrow/benches/filter_kernels.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arrow/benches/filter_kernels.rs b/arrow/benches/filter_kernels.rs index 50f3cb40094d..e48b5302241d 100644 --- a/arrow/benches/filter_kernels.rs +++ b/arrow/benches/filter_kernels.rs @@ -214,6 +214,32 @@ fn add_benchmark(c: &mut Criterion) { c.bench_function("filter single record batch", |b| { b.iter(|| filter_record_batch(&batch, &filter_array)) }); + + let data_array = create_string_view_array_with_len(size, 0.5, 4, false); + c.bench_function("filter context short string view (kept 1/2)", |b| { + b.iter(|| bench_built_filter(&filter, &data_array)) + }); + c.bench_function( + "filter context short string view high selectivity (kept 1023/1024)", + |b| b.iter(|| bench_built_filter(&dense_filter, &data_array)), + ); + c.bench_function( + "filter context short string view low selectivity (kept 1/1024)", + |b| b.iter(|| bench_built_filter(&sparse_filter, &data_array)), + ); + + let data_array = create_string_view_array_with_len(size, 0.5, 4, true); + c.bench_function("filter context mixed string view (kept 1/2)", |b| { + b.iter(|| bench_built_filter(&filter, &data_array)) + }); + c.bench_function( + "filter context mixed string view high selectivity (kept 1023/1024)", + |b| b.iter(|| bench_built_filter(&dense_filter, &data_array)), + ); + c.bench_function( + "filter context mixed string view low selectivity (kept 1/1024)", + |b| b.iter(|| bench_built_filter(&sparse_filter, &data_array)), + ); } criterion_group!(benches, add_benchmark);