Skip to content

Commit 39835fb

Browse files
committed
split benches
Signed-off-by: Onur Satici <[email protected]>
1 parent e8ada77 commit 39835fb

File tree

9 files changed

+69
-47
lines changed

9 files changed

+69
-47
lines changed

encodings/fsst/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ name = "fsst_compress"
4444
harness = false
4545

4646
[[bench]]
47-
name = "chunked_dict_array_builder"
47+
name = "chunked_dict_fsst_builder"
4848
harness = false
4949
required-features = ["test-harness"]

encodings/fsst/benches/chunked_dict_array_builder.rs renamed to encodings/fsst/benches/chunked_dict_fsst_builder.rs

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

44
use divan::Bencher;
5-
use rand::distr::{Distribution, StandardUniform};
65
use vortex_array::arrays::ChunkedArray;
7-
use vortex_array::arrays::dict_test::gen_dict_primitive_chunks;
86
use vortex_array::builders::builder_with_capacity;
97
use vortex_array::compute::warm_up_vtables;
108
use vortex_array::{Array, ArrayRef, IntoArray};
@@ -25,36 +23,6 @@ const BENCH_ARGS: &[(usize, usize, usize)] = &[
2523
(1000, 1000, 100),
2624
];
2725

28-
#[divan::bench(types = [u32, u64, f32, f64], args = BENCH_ARGS)]
29-
fn chunked_dict_primitive_canonical_into<T: NativePType>(
30-
bencher: Bencher,
31-
(len, unique_values, chunk_count): (usize, usize, usize),
32-
) where
33-
StandardUniform: Distribution<T>,
34-
{
35-
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);
36-
37-
bencher.with_inputs(|| chunk.clone()).bench_values(|chunk| {
38-
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
39-
chunk.append_to_builder(builder.as_mut());
40-
builder.finish()
41-
})
42-
}
43-
44-
#[divan::bench(types = [u32, u64, f32, f64], args = BENCH_ARGS)]
45-
fn chunked_dict_primitive_into_canonical<T: NativePType>(
46-
bencher: Bencher,
47-
(len, unique_values, chunk_count): (usize, usize, usize),
48-
) where
49-
StandardUniform: Distribution<T>,
50-
{
51-
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);
52-
53-
bencher
54-
.with_inputs(|| chunk.clone())
55-
.bench_values(|chunk| chunk.to_canonical())
56-
}
57-
5826
fn make_dict_fsst_chunks<T: NativePType>(
5927
len: usize,
6028
unique_values: usize,

vortex-array/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ harness = false
140140
name = "expr_large_struct_pack"
141141
path = "benches/expr/large_struct_pack.rs"
142142
harness = false
143+
144+
[[bench]]
145+
name = "chunked_dict_builder"
146+
harness = false
147+
required-features = ["test-harness"]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
use divan::Bencher;
5+
use rand::distr::{Distribution, StandardUniform};
6+
use vortex_array::Array;
7+
use vortex_array::arrays::dict_test::gen_dict_primitive_chunks;
8+
use vortex_array::builders::builder_with_capacity;
9+
use vortex_array::compute::warm_up_vtables;
10+
use vortex_dtype::NativePType;
11+
12+
fn main() {
13+
warm_up_vtables();
14+
divan::main();
15+
}
16+
17+
const BENCH_ARGS: &[(usize, usize, usize)] = &[
18+
(1000, 10, 10),
19+
(1000, 100, 10),
20+
(1000, 1000, 10),
21+
(1000, 10, 100),
22+
(1000, 100, 100),
23+
(1000, 1000, 100),
24+
];
25+
26+
#[divan::bench(types = [u32, u64, f32, f64], args = BENCH_ARGS)]
27+
fn chunked_dict_primitive_canonical_into<T: NativePType>(
28+
bencher: Bencher,
29+
(len, unique_values, chunk_count): (usize, usize, usize),
30+
) where
31+
StandardUniform: Distribution<T>,
32+
{
33+
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);
34+
35+
bencher.with_inputs(|| chunk.clone()).bench_values(|chunk| {
36+
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
37+
chunk.append_to_builder(builder.as_mut());
38+
builder.finish()
39+
})
40+
}
41+
42+
#[divan::bench(types = [u32, u64, f32, f64], args = BENCH_ARGS)]
43+
fn chunked_dict_primitive_into_canonical<T: NativePType>(
44+
bencher: Bencher,
45+
(len, unique_values, chunk_count): (usize, usize, usize),
46+
) where
47+
StandardUniform: Distribution<T>,
48+
{
49+
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);
50+
51+
bencher
52+
.with_inputs(|| chunk.clone())
53+
.bench_values(|chunk| chunk.to_canonical())
54+
}

vortex-duckdb/src/exporter/dict.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use std::sync::Arc;
77
use bitvec::macros::internal::funty::Fundamental;
88
use num_traits::AsPrimitive;
99
use parking_lot::Mutex;
10-
use vortex::arrays::DictArray;
11-
use vortex::arrays::{ConstantArray, ConstantVTable, PrimitiveArray};
10+
use vortex::arrays::{ConstantArray, ConstantVTable, DictArray, PrimitiveArray};
1211
use vortex::dtype::{IntegerPType, match_each_integer_ptype};
1312
use vortex::error::VortexResult;
1413
use vortex::mask::Mask;
@@ -149,8 +148,7 @@ impl<I: IntegerPType + AsPrimitive<u32>> ColumnExporter for DictExporter<I> {
149148
#[cfg(test)]
150149
mod tests {
151150
use vortex::IntoArray;
152-
use vortex::arrays::DictArray;
153-
use vortex::arrays::{ConstantArray, PrimitiveArray};
151+
use vortex::arrays::{ConstantArray, DictArray, PrimitiveArray};
154152
use vortex::buffer::Buffer;
155153
use vortex::error::VortexResult;
156154

vortex-duckdb/src/exporter/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ use bitvec::view::BitView;
2424
pub use cache::ConversionCache;
2525
pub use decimal::precision_to_duckdb_storage_size;
2626
use itertools::Itertools;
27-
use vortex::arrays::DictVTable;
28-
use vortex::arrays::{ConstantVTable, StructArray, TemporalArray};
27+
use vortex::arrays::{ConstantVTable, DictVTable, StructArray, TemporalArray};
2928
use vortex::dtype::datetime::is_temporal_ext_type;
3029
use vortex::encodings::runend::RunEndVTable;
3130
use vortex::encodings::sequence::SequenceVTable;

vortex-duckdb/src/exporter/struct_.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ mod tests {
5454
use std::ffi::CString;
5555

5656
use vortex::IntoArray;
57-
use vortex::arrays::DictArray;
58-
use vortex::arrays::{ConstantArray, PrimitiveArray, VarBinViewArray};
57+
use vortex::arrays::{ConstantArray, DictArray, PrimitiveArray, VarBinViewArray};
5958
use vortex::buffer::{BitBuffer, buffer};
6059
use vortex::error::{VortexExpect, VortexUnwrap};
6160
use vortex::validity::Validity;

vortex-file/src/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ use futures::{StreamExt, TryStreamExt, pin_mut};
1010
use itertools::Itertools;
1111
use vortex_array::accessor::ArrayAccessor;
1212
use vortex_array::arrays::{
13-
ChunkedArray, ConstantArray, DecimalArray, ListArray, PrimitiveArray, StructArray, VarBinArray,
14-
VarBinViewArray,
13+
ChunkedArray, ConstantArray, DecimalArray, DictEncoding, DictVTable, ListArray, PrimitiveArray,
14+
StructArray, VarBinArray, VarBinViewArray,
1515
};
16-
use vortex_array::arrays::{DictEncoding, DictVTable};
1716
use vortex_array::expr::{
1817
Pack, PackOptions, VTableExt, and, eq, get_item, gt, gt_eq, lit, lt, lt_eq, or, root, select,
1918
};

vortex-python/src/arrays/native.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use std::ops::Deref;
66
use pyo3::PyClass;
77
use pyo3::exceptions::PyTypeError;
88
use pyo3::prelude::*;
9-
use vortex::arrays::DictVTable;
109
use vortex::arrays::{
11-
BoolVTable, ChunkedVTable, ConstantVTable, DecimalVTable, ExtensionVTable, FixedSizeListVTable,
12-
ListVTable, NullVTable, PrimitiveVTable, StructVTable, VarBinVTable, VarBinViewVTable,
10+
BoolVTable, ChunkedVTable, ConstantVTable, DecimalVTable, DictVTable, ExtensionVTable,
11+
FixedSizeListVTable, ListVTable, NullVTable, PrimitiveVTable, StructVTable, VarBinVTable,
12+
VarBinViewVTable,
1313
};
1414
use vortex::encodings::alp::{ALPRDVTable, ALPVTable};
1515
use vortex::encodings::bytebool::ByteBoolVTable;

0 commit comments

Comments
 (0)