Skip to content

Commit 7c20fd4

Browse files
authored
chore: trim micro-bench input sizes (#6890)
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 15dd7ab commit 7c20fd4

File tree

8 files changed

+39
-38
lines changed

8 files changed

+39
-38
lines changed

encodings/fastlanes/benches/bitpacking_take.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ fn main() {
2828

2929
#[divan::bench]
3030
fn take_10_stratified(bencher: Bencher) {
31-
let values = fixture(1_000_000, 8);
31+
let values = fixture(65_536, 8);
3232
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
3333
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
34-
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 10_000));
34+
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 6_553));
3535

3636
bencher
3737
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
@@ -46,7 +46,7 @@ fn take_10_stratified(bencher: Bencher) {
4646

4747
#[divan::bench]
4848
fn take_10_contiguous(bencher: Bencher) {
49-
let values = fixture(1_000_000, 8);
49+
let values = fixture(65_536, 8);
5050
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
5151
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
5252
let indices = buffer![0..10].into_array();
@@ -64,7 +64,7 @@ fn take_10_contiguous(bencher: Bencher) {
6464

6565
#[divan::bench]
6666
fn take_10k_random(bencher: Bencher) {
67-
let values = fixture(1_000_000, 8);
67+
let values = fixture(65_536, 8);
6868
let range = Uniform::new(0, values.len()).unwrap();
6969
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
7070
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
@@ -85,7 +85,7 @@ fn take_10k_random(bencher: Bencher) {
8585

8686
#[divan::bench]
8787
fn take_10k_contiguous(bencher: Bencher) {
88-
let values = fixture(1_000_000, 8);
88+
let values = fixture(65_536, 8);
8989
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
9090
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
9191
let indices = PrimitiveArray::from_iter(0..10_000);
@@ -102,11 +102,11 @@ fn take_10k_contiguous(bencher: Bencher) {
102102
}
103103

104104
#[divan::bench]
105-
fn take_200k_dispersed(bencher: Bencher) {
106-
let values = fixture(1_000_000, 8);
105+
fn take_10k_dispersed(bencher: Bencher) {
106+
let values = fixture(65_536, 8);
107107
let uncompressed = PrimitiveArray::new(values.clone(), Validity::NonNullable);
108108
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
109-
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| (i * 42) % values.len() as u64));
109+
let indices = PrimitiveArray::from_iter((0..10_000).map(|i| (i * 42) % values.len() as u64));
110110

111111
bencher
112112
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
@@ -120,11 +120,11 @@ fn take_200k_dispersed(bencher: Bencher) {
120120
}
121121

122122
#[divan::bench]
123-
fn take_200k_first_chunk_only(bencher: Bencher) {
124-
let values = fixture(1_000_000, 8);
123+
fn take_10k_first_chunk_only(bencher: Bencher) {
124+
let values = fixture(65_536, 8);
125125
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
126126
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
127-
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| ((i * 42) % 1024) as u64));
127+
let indices = PrimitiveArray::from_iter((0..10_000).map(|i| ((i * 42) % 1024) as u64));
128128

129129
bencher
130130
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
@@ -154,8 +154,8 @@ fn fixture(len: usize, bits: usize) -> Buffer<u32> {
154154
// I've iterated on both thresholds (1) and (2) using this collection of benchmarks, and those
155155
// were roughly the best values that I found.
156156

157-
const BIG_BASE2: u32 = 1048576;
158-
const NUM_EXCEPTIONS: u32 = 10000;
157+
const BIG_BASE2: u32 = 65536;
158+
const NUM_EXCEPTIONS: u32 = 1024;
159159

160160
#[divan::bench]
161161
fn patched_take_10_stratified(bencher: Bencher) {
@@ -169,7 +169,7 @@ fn patched_take_10_stratified(bencher: Bencher) {
169169
NUM_EXCEPTIONS as usize
170170
);
171171

172-
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 10_000));
172+
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 6_653));
173173

174174
bencher
175175
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
@@ -273,11 +273,11 @@ fn patched_take_10k_contiguous_patches(bencher: Bencher) {
273273
}
274274

275275
#[divan::bench]
276-
fn patched_take_200k_dispersed(bencher: Bencher) {
276+
fn patched_take_10k_dispersed(bencher: Bencher) {
277277
let values = (0u32..BIG_BASE2 + NUM_EXCEPTIONS).collect::<Buffer<u32>>();
278278
let uncompressed = PrimitiveArray::new(values.clone(), Validity::NonNullable);
279279
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
280-
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| (i * 42) % values.len() as u64));
280+
let indices = PrimitiveArray::from_iter((0..10_000).map(|i| (i * 42) % values.len() as u64));
281281

282282
bencher
283283
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
@@ -291,11 +291,11 @@ fn patched_take_200k_dispersed(bencher: Bencher) {
291291
}
292292

293293
#[divan::bench]
294-
fn patched_take_200k_first_chunk_only(bencher: Bencher) {
294+
fn patched_take_10k_first_chunk_only(bencher: Bencher) {
295295
let values = (0u32..BIG_BASE2 + NUM_EXCEPTIONS).collect::<Buffer<u32>>();
296296
let uncompressed = PrimitiveArray::new(values, Validity::NonNullable);
297297
let packed = bitpack_to_best_bit_width(&uncompressed).unwrap();
298-
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| ((i * 42) % 1024) as u64));
298+
let indices = PrimitiveArray::from_iter((0..10_000).map(|i| ((i * 42) % 1024) as u64));
299299

300300
bencher
301301
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))

encodings/runend/benches/run_end_compress.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ const BENCH_ARGS: &[(usize, usize)] = &[
3636
(100_000, 256),
3737
(100_000, 1024),
3838
(100_000, 4096),
39-
(1_000_000, 4),
40-
(1_000_000, 16),
41-
(1_000_000, 256),
42-
(1_000_000, 1024),
43-
(1_000_000, 4096),
44-
(1_000_000, 8192),
4539
];
4640

4741
#[divan::bench(args = BENCH_ARGS)]

vortex-array/benches/compare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
divan::main();
2222
}
2323

24-
const ARRAY_SIZE: usize = 10_000_000;
24+
const ARRAY_SIZE: usize = 65_536;
2525

2626
#[divan::bench]
2727
fn compare_bool(bencher: Bencher) {

vortex-array/benches/search_sorted.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn binary_search_vortex(bencher: Bencher) {
3333

3434
fn fixture() -> (Vec<i32>, i32) {
3535
let mut rng = StdRng::seed_from_u64(0);
36-
let range = Uniform::new(0, 1_000_000).unwrap();
37-
let mut data: Vec<i32> = (0..1_000_000).map(|_| rng.sample(range)).collect();
36+
let range = Uniform::new(0, 65_536).unwrap();
37+
let mut data: Vec<i32> = (0..65_536).map(|_| rng.sample(range)).collect();
3838
data.sort();
3939

4040
(data, rng.sample(range))

vortex-array/benches/take_fsl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
}
2929

3030
/// Number of lists in the source array.
31-
const NUM_LISTS: usize = 10_000;
31+
const NUM_LISTS: usize = 500;
3232

3333
/// Number of indices to take.
3434
const NUM_INDICES: &[usize] = &[100, 1_000];

vortex-btrblocks/benches/compress.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ mod benchmarks {
2121

2222
fn make_clickbench_window_name() -> ArrayRef {
2323
// A test that's meant to mirror the WindowName column from ClickBench.
24-
let mut values = buffer_mut![-1i32; 1_000_000];
24+
let mut values = buffer_mut![-1i32; 65_536];
2525
let mut visited = HashSet::new();
2626
let mut rng = StdRng::seed_from_u64(1u64);
2727
while visited.len() < 223 {
28-
let random = (rng.next_u32() as usize) % 1_000_000;
28+
let random = (rng.next_u32() as usize) % 65_536;
2929
if visited.contains(&random) {
3030
continue;
3131
}

vortex/benches/common_encoding_tree_throughput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn main() {
4444
divan::main();
4545
}
4646

47-
const NUM_VALUES: u64 = 1_000_000;
47+
const NUM_VALUES: u64 = 100_000;
4848

4949
// Helper function to conditionally add counter based on codspeed cfg
5050
fn with_byte_counter<'a, 'b>(bencher: Bencher<'a, 'b>, bytes: u64) -> Bencher<'a, 'b> {

vortex/benches/single_encoding_throughput.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
#![allow(clippy::unwrap_used)]
5+
#![allow(clippy::cast_possible_truncation)]
56
#![allow(unexpected_cfgs)]
67

78
use divan::Bencher;
@@ -41,7 +42,7 @@ fn main() {
4142
divan::main();
4243
}
4344

44-
const NUM_VALUES: u64 = 1_000_000;
45+
const NUM_VALUES: u64 = 100_000;
4546

4647
// Helper function to conditionally add counter based on codspeed cfg
4748
fn with_byte_counter<'a, 'b>(bencher: Bencher<'a, 'b>, bytes: u64) -> Bencher<'a, 'b> {
@@ -326,7 +327,8 @@ fn bench_zstd_decompress_u32(bencher: Bencher) {
326327
// String compression benchmarks
327328
#[divan::bench(name = "dict_compress_string")]
328329
fn bench_dict_compress_string(bencher: Bencher) {
329-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
330+
let varbinview_arr =
331+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
330332
let nbytes = varbinview_arr.nbytes() as u64;
331333

332334
with_byte_counter(bencher, nbytes)
@@ -336,7 +338,8 @@ fn bench_dict_compress_string(bencher: Bencher) {
336338

337339
#[divan::bench(name = "dict_decompress_string")]
338340
fn bench_dict_decompress_string(bencher: Bencher) {
339-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
341+
let varbinview_arr =
342+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
340343
let dict = dict_encode(&varbinview_arr.clone().into_array()).unwrap();
341344
let nbytes = varbinview_arr.into_array().nbytes() as u64;
342345

@@ -347,7 +350,8 @@ fn bench_dict_decompress_string(bencher: Bencher) {
347350

348351
#[divan::bench(name = "fsst_compress_string")]
349352
fn bench_fsst_compress_string(bencher: Bencher) {
350-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
353+
let varbinview_arr =
354+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
351355
let fsst_compressor = fsst_train_compressor(&varbinview_arr);
352356
let nbytes = varbinview_arr.nbytes() as u64;
353357

@@ -358,7 +362,8 @@ fn bench_fsst_compress_string(bencher: Bencher) {
358362

359363
#[divan::bench(name = "fsst_decompress_string")]
360364
fn bench_fsst_decompress_string(bencher: Bencher) {
361-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
365+
let varbinview_arr =
366+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
362367
let fsst_compressor = fsst_train_compressor(&varbinview_arr);
363368
let fsst_array = fsst_compress(&varbinview_arr, &fsst_compressor);
364369
let nbytes = varbinview_arr.into_array().nbytes() as u64;
@@ -371,7 +376,8 @@ fn bench_fsst_decompress_string(bencher: Bencher) {
371376
#[cfg(feature = "zstd")]
372377
#[divan::bench(name = "zstd_compress_string")]
373378
fn bench_zstd_compress_string(bencher: Bencher) {
374-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
379+
let varbinview_arr =
380+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
375381
let nbytes = varbinview_arr.nbytes() as u64;
376382
let array = varbinview_arr.into_array();
377383

@@ -383,7 +389,8 @@ fn bench_zstd_compress_string(bencher: Bencher) {
383389
#[cfg(feature = "zstd")]
384390
#[divan::bench(name = "zstd_decompress_string")]
385391
fn bench_zstd_decompress_string(bencher: Bencher) {
386-
let varbinview_arr = VarBinViewArray::from_iter_str(gen_varbin_words(1_000_000, 0.00005));
392+
let varbinview_arr =
393+
VarBinViewArray::from_iter_str(gen_varbin_words(NUM_VALUES as usize, 0.00005));
387394
let compressed = ZstdArray::from_array(varbinview_arr.clone().into_array(), 3, 8192).unwrap();
388395
let nbytes = varbinview_arr.into_array().nbytes() as u64;
389396

0 commit comments

Comments
 (0)