From f10dba08b86f8dacd3c9fafb1f8e5fec1004a177 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 14:43:23 +0000 Subject: [PATCH 1/2] bench: Force initialisation of vortex session before benchmarking loop Signed-off-by: Robert Kruszewski --- vortex-array/benches/aggregate_grouped.rs | 1 + vortex-array/benches/aggregate_max.rs | 4 +++- vortex-array/benches/aggregate_sum.rs | 4 +++- vortex-array/benches/binary_ops.rs | 4 +++- vortex-array/benches/bool_zip.rs | 4 +++- vortex-array/benches/cast_primitive.rs | 4 +++- vortex-array/benches/chunk_array_builder.rs | 4 +++- vortex-array/benches/chunked_dict_builder.rs | 1 + vortex-array/benches/chunked_fsl_canonicalize.rs | 4 +++- vortex-array/benches/dict_compare.rs | 4 +++- vortex-array/benches/dict_compress.rs | 4 +++- vortex-array/benches/expr/case_when_bench.rs | 4 +++- vortex-array/benches/filter_bool.rs | 4 +++- vortex-array/benches/listview_rebuild.rs | 4 +++- vortex-array/benches/primitive_zip.rs | 13 +++++++------ vortex-array/benches/scalar_at_struct.rs | 4 +++- vortex-array/benches/scalar_subtract.rs | 11 +++++------ vortex-array/benches/take_filter.rs | 4 +++- vortex-array/benches/take_fsl.rs | 4 +++- vortex-array/benches/take_patches.rs | 4 +++- vortex-array/benches/take_primitive.rs | 4 +++- vortex-array/benches/take_struct.rs | 4 +++- vortex-array/benches/to_arrow.rs | 14 +++----------- vortex-array/benches/varbinview_zip.rs | 4 +++- vortex-array/src/test_harness.rs | 3 +++ vortex-compressor/benches/dict_encode.rs | 4 +++- vortex-row/benches/row_encode.rs | 5 ++++- vortex/benches/common_encoding_tree_throughput.rs | 3 +++ vortex/benches/single_encoding_throughput.rs | 3 +++ 29 files changed, 90 insertions(+), 44 deletions(-) diff --git a/vortex-array/benches/aggregate_grouped.rs b/vortex-array/benches/aggregate_grouped.rs index fdc43dbcabd..11477e57503 100644 --- a/vortex-array/benches/aggregate_grouped.rs +++ b/vortex-array/benches/aggregate_grouped.rs @@ -28,6 +28,7 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } diff --git a/vortex-array/benches/aggregate_max.rs b/vortex-array/benches/aggregate_max.rs index 4da7d1fc653..a47bdb28164 100644 --- a/vortex-array/benches/aggregate_max.rs +++ b/vortex-array/benches/aggregate_max.rs @@ -7,16 +7,18 @@ use divan::Bencher; use rand::prelude::*; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } const N: usize = 100_000; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench] fn max_i32(bencher: Bencher) { diff --git a/vortex-array/benches/aggregate_sum.rs b/vortex-array/benches/aggregate_sum.rs index 81402b24750..98e6845edb7 100644 --- a/vortex-array/benches/aggregate_sum.rs +++ b/vortex-array/benches/aggregate_sum.rs @@ -7,17 +7,19 @@ use divan::Bencher; use rand::prelude::*; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_array::expr::stats::Stat; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } const N: usize = 100_000; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench] fn sum_i32(bencher: Bencher) { diff --git a/vortex-array/benches/binary_ops.rs b/vortex-array/benches/binary_ops.rs index 98c69413193..d1f664f8645 100644 --- a/vortex-array/benches/binary_ops.rs +++ b/vortex-array/benches/binary_ops.rs @@ -15,6 +15,7 @@ use vortex_array::ArrayRef; use vortex_array::Executable; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_array::arrays::ConstantArray; use vortex_array::arrays::PrimitiveArray; @@ -23,10 +24,11 @@ use vortex_array::scalar_fn::fns::operators::Operator; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const LEN: usize = 65_536; diff --git a/vortex-array/benches/bool_zip.rs b/vortex-array/benches/bool_zip.rs index 40496fd1f0b..d1fc96c457e 100644 --- a/vortex-array/benches/bool_zip.rs +++ b/vortex-array/benches/bool_zip.rs @@ -10,16 +10,18 @@ use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_array::builtins::ArrayBuiltins; use vortex_mask::Mask; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const LEN: usize = 65_536; diff --git a/vortex-array/benches/cast_primitive.rs b/vortex-array/benches/cast_primitive.rs index 3fd89270517..69a4c5d2cc5 100644 --- a/vortex-array/benches/cast_primitive.rs +++ b/vortex-array/benches/cast_primitive.rs @@ -10,6 +10,7 @@ use rand::prelude::*; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_array::builtins::ArrayBuiltins; use vortex_array::dtype::DType; @@ -19,6 +20,7 @@ use vortex_array::expr::stats::Stat; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } @@ -26,7 +28,7 @@ fn main() { // the kernel cost shows up clearly rather than being hidden by DRAM bandwidth. const SIZES: &[usize] = &[65_536]; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench(args = SIZES)] fn cast_u16_to_u32(bencher: Bencher, n: usize) { diff --git a/vortex-array/benches/chunk_array_builder.rs b/vortex-array/benches/chunk_array_builder.rs index 6582071a6e1..124db6e0f61 100644 --- a/vortex-array/benches/chunk_array_builder.rs +++ b/vortex-array/benches/chunk_array_builder.rs @@ -11,6 +11,7 @@ use vortex_array::ArrayRef; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::ConstantArray; @@ -22,6 +23,7 @@ use vortex_error::VortexExpect; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } @@ -32,7 +34,7 @@ const BENCH_ARGS: &[(usize, usize)] = &[ (1000, 10), ]; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench(args = BENCH_ARGS)] fn chunked_bool_canonical_into(bencher: Bencher, (len, chunk_count): (usize, usize)) { diff --git a/vortex-array/benches/chunked_dict_builder.rs b/vortex-array/benches/chunked_dict_builder.rs index 74722235e54..de2f40dcbf5 100644 --- a/vortex-array/benches/chunked_dict_builder.rs +++ b/vortex-array/benches/chunked_dict_builder.rs @@ -15,6 +15,7 @@ use vortex_error::VortexExpect; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } diff --git a/vortex-array/benches/chunked_fsl_canonicalize.rs b/vortex-array/benches/chunked_fsl_canonicalize.rs index 4277b33382e..9be8433ce9d 100644 --- a/vortex-array/benches/chunked_fsl_canonicalize.rs +++ b/vortex-array/benches/chunked_fsl_canonicalize.rs @@ -16,6 +16,7 @@ use divan::Bencher; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::FixedSizeListArray; use vortex_array::validity::Validity; @@ -23,10 +24,11 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); /// Number of lists in each chunk. const LISTS_PER_CHUNK: usize = 1_000; diff --git a/vortex-array/benches/dict_compare.rs b/vortex-array/benches/dict_compare.rs index 446623939f1..5b31cf51831 100644 --- a/vortex-array/benches/dict_compare.rs +++ b/vortex-array/benches/dict_compare.rs @@ -9,6 +9,7 @@ use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::ConstantArray; use vortex_array::arrays::VarBinArray; use vortex_array::arrays::VarBinViewArray; @@ -24,10 +25,11 @@ use vortex_array::scalar_fn::fns::operators::Operator; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const LENGTH_AND_UNIQUE_VALUES: &[(usize, usize)] = &[ // length, unique_values diff --git a/vortex-array/benches/dict_compress.rs b/vortex-array/benches/dict_compress.rs index 2901d82c6b5..6dd8150dc02 100644 --- a/vortex-array/benches/dict_compress.rs +++ b/vortex-array/benches/dict_compress.rs @@ -11,6 +11,7 @@ use rand::distr::StandardUniform; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::VarBinArray; use vortex_array::arrays::VarBinViewArray; use vortex_array::arrays::dict_test::gen_primitive_for_dict; @@ -20,6 +21,7 @@ use vortex_array::dtype::NativePType; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } @@ -37,7 +39,7 @@ const BENCH_ARGS: &[(usize, usize)] = &[ (10_000, 512), ]; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench(types = [u8, f32, i64], args = BENCH_ARGS)] fn encode_primitives(bencher: Bencher, (len, unique_values): (usize, usize)) diff --git a/vortex-array/benches/expr/case_when_bench.rs b/vortex-array/benches/expr/case_when_bench.rs index 1bada8fa9e1..c7b0e96686d 100644 --- a/vortex-array/benches/expr/case_when_bench.rs +++ b/vortex-array/benches/expr/case_when_bench.rs @@ -11,6 +11,7 @@ use vortex_array::ArrayRef; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_array::arrays::StructArray; use vortex_array::expr::case_when; @@ -25,9 +26,10 @@ use vortex_array::expr::root; use vortex_buffer::Buffer; use vortex_session::VortexSession; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn main() { + LazyLock::force(&SESSION); divan::main(); } diff --git a/vortex-array/benches/filter_bool.rs b/vortex-array/benches/filter_bool.rs index cd31805bb77..20782a539b8 100644 --- a/vortex-array/benches/filter_bool.rs +++ b/vortex-array/benches/filter_bool.rs @@ -18,16 +18,18 @@ use rand::prelude::*; use rand_distr::Zipf; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_buffer::BitBuffer; use vortex_mask::Mask; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const SIZES: &[usize] = &[1_000, 10_000, 100_000, 250_000]; const DENSITY_SWEEP_SIZE: usize = 100_000; diff --git a/vortex-array/benches/listview_rebuild.rs b/vortex-array/benches/listview_rebuild.rs index 81157d52b5a..2e61b969244 100644 --- a/vortex-array/benches/listview_rebuild.rs +++ b/vortex-array/benches/listview_rebuild.rs @@ -12,6 +12,7 @@ use divan::Bencher; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::FixedSizeListArray; use vortex_array::arrays::ListArray; use vortex_array::arrays::ListViewArray; @@ -26,11 +27,12 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } /// A shared session for the `ListView` rebuild benchmarks, used to create execution contexts. -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn make_primitive_lv(num_lists: usize, list_size: usize, step: usize) -> ListViewArray { let element_count = step * num_lists + list_size; diff --git a/vortex-array/benches/primitive_zip.rs b/vortex-array/benches/primitive_zip.rs index adcabf51d7d..dbebd534686 100644 --- a/vortex-array/benches/primitive_zip.rs +++ b/vortex-array/benches/primitive_zip.rs @@ -9,21 +9,25 @@ use std::sync::LazyLock; +use arrow_array::ArrayRef; use divan::Bencher; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_array::builtins::ArrayBuiltins; +use vortex_array::validity::Validity; use vortex_buffer::BufferMut; use vortex_mask::Mask; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); // Sized so the bench stays well under a few hundred microseconds under CodSpeed's instruction-count // simulation, which runs ~10x the local walltime; the branchless value blend is still exercised. @@ -49,7 +53,7 @@ fn nullable(bencher: Bencher) { run(bencher, if_true, if_false); } -fn run(bencher: Bencher, if_true: vortex_array::ArrayRef, if_false: vortex_array::ArrayRef) { +fn run(bencher: Bencher, if_true: ArrayRef, if_false: ArrayRef) { let mask = mask(); bencher .with_inputs(|| { @@ -71,10 +75,7 @@ fn run(bencher: Bencher, if_true: vortex_array::ArrayRef, if_false: vortex_array fn nonnull_array(base: i64) -> PrimitiveArray { let mut values = BufferMut::::with_capacity(LEN); values.extend((0..LEN as i64).map(|i| base + i)); - PrimitiveArray::new( - values.freeze(), - vortex_array::validity::Validity::NonNullable, - ) + PrimitiveArray::new(values.freeze(), Validity::NonNullable) } fn nullable_array(base: i64, null_every: usize) -> PrimitiveArray { diff --git a/vortex-array/benches/scalar_at_struct.rs b/vortex-array/benches/scalar_at_struct.rs index 3921f0a2366..8dca44e408a 100644 --- a/vortex-array/benches/scalar_at_struct.rs +++ b/vortex-array/benches/scalar_at_struct.rs @@ -13,6 +13,7 @@ use rand::rngs::StdRng; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::StructArray; use vortex_array::dtype::FieldNames; use vortex_array::validity::Validity; @@ -20,13 +21,14 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } const ARRAY_SIZE: usize = 100_000; const NUM_ACCESSES: usize = 1000; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench] fn execute_scalar_struct_simple(bencher: Bencher) { diff --git a/vortex-array/benches/scalar_subtract.rs b/vortex-array/benches/scalar_subtract.rs index ee9aba1055d..bce530a90ac 100644 --- a/vortex-array/benches/scalar_subtract.rs +++ b/vortex-array/benches/scalar_subtract.rs @@ -5,6 +5,7 @@ use std::sync::LazyLock; +use arrow_array::Scalar; use divan::Bencher; use rand::RngExt; use rand::SeedableRng; @@ -13,6 +14,7 @@ use rand::rngs::StdRng; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::ConstantArray; use vortex_array::builtins::ArrayBuiltins; @@ -21,10 +23,11 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); #[divan::bench] fn scalar_subtract(bencher: Bencher) { @@ -50,11 +53,7 @@ fn scalar_subtract(bencher: Bencher) { chunked .clone() .binary( - ConstantArray::new( - vortex_array::scalar::Scalar::from(to_subtract), - chunked.len(), - ) - .into_array(), + ConstantArray::new(Scalar::from(to_subtract), chunked.len()).into_array(), Operator::Sub, ) .unwrap() diff --git a/vortex-array/benches/take_filter.rs b/vortex-array/benches/take_filter.rs index b6ec1b4040c..96852a91966 100644 --- a/vortex-array/benches/take_filter.rs +++ b/vortex-array/benches/take_filter.rs @@ -28,6 +28,7 @@ use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::ListArray; use vortex_array::arrays::PrimitiveArray; use vortex_array::validity::Validity; @@ -38,6 +39,7 @@ use vortex_mask::Mask; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } @@ -57,7 +59,7 @@ const INDEX_SEED: u64 = 43; const LIST_SIZE: usize = 4; const NULL_INDEX_INTERVAL: usize = 8; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn primitive_array() -> ArrayRef { PrimitiveArray::from_iter(0..ARRAY_LEN as u32).into_array() diff --git a/vortex-array/benches/take_fsl.rs b/vortex-array/benches/take_fsl.rs index 438faae4983..5dc491c28c5 100644 --- a/vortex-array/benches/take_fsl.rs +++ b/vortex-array/benches/take_fsl.rs @@ -19,16 +19,18 @@ use rand::rngs::StdRng; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::FixedSizeListArray; use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); /// Number of lists in the source array. const NUM_LISTS: usize = 500; diff --git a/vortex-array/benches/take_patches.rs b/vortex-array/benches/take_patches.rs index 5dc0c04c325..b935f97b54b 100644 --- a/vortex-array/benches/take_patches.rs +++ b/vortex-array/benches/take_patches.rs @@ -15,15 +15,17 @@ use vortex_array::IntoArray; #[expect(deprecated)] use vortex_array::ToCanonical as _; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::patches::Patches; use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const BENCH_ARGS: &[(f64, f64)] = &[ // patches_sparsity, index_multiple diff --git a/vortex-array/benches/take_primitive.rs b/vortex-array/benches/take_primitive.rs index 383b525dcc6..471363b99e4 100644 --- a/vortex-array/benches/take_primitive.rs +++ b/vortex-array/benches/take_primitive.rs @@ -17,11 +17,13 @@ use rand_distr::Zipf; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::DictArray; use vortex_array::arrays::PrimitiveArray; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } @@ -31,7 +33,7 @@ const NUM_INDICES: &[usize] = &[1_000, 10_000, 100_000]; /// Size of the source vector / dictionary values. const VECTOR_SIZE: &[usize] = &[16, 256, 2048, 8192]; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); // --- DictArray canonicalization benchmarks --- diff --git a/vortex-array/benches/take_struct.rs b/vortex-array/benches/take_struct.rs index d49ce9e88a6..9f7e518cb3a 100644 --- a/vortex-array/benches/take_struct.rs +++ b/vortex-array/benches/take_struct.rs @@ -13,6 +13,7 @@ use rand::rngs::StdRng; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::StructArray; use vortex_array::dtype::FieldNames; use vortex_array::validity::Validity; @@ -20,10 +21,11 @@ use vortex_buffer::Buffer; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); const ARRAY_SIZE: usize = 100_000; const TAKE_SIZE: usize = 1000; diff --git a/vortex-array/benches/to_arrow.rs b/vortex-array/benches/to_arrow.rs index 48e5e917476..99fc0fa4f80 100644 --- a/vortex-array/benches/to_arrow.rs +++ b/vortex-array/benches/to_arrow.rs @@ -10,6 +10,7 @@ use divan::Bencher; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::DecimalArray; use vortex_array::arrays::ListArray; use vortex_array::arrays::PrimitiveArray; @@ -28,10 +29,11 @@ use vortex_array::dtype::StructFields; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn schema() -> DType { let fields = StructFields::from_iter([ @@ -89,9 +91,6 @@ fn to_arrow_dtype(bencher: Bencher) { #[allow(non_snake_case)] #[divan::bench] fn ArrowExportVTable_to_arrow_field(bencher: Bencher) { - // Warm the ArrowSession - drop(SESSION.arrow().to_arrow_field("", &schema()).unwrap()); - bencher .with_inputs(schema) .bench_values(|dtype| SESSION.arrow().to_arrow_field("", &dtype).unwrap()) @@ -110,13 +109,6 @@ fn to_arrow_array(bencher: Bencher) { #[allow(non_snake_case)] #[divan::bench] fn ArrowExportVTable_execute_arrow(bencher: Bencher) { - // Warm the ArrowSession - drop( - SESSION - .arrow() - .execute_arrow(array(), None, &mut SESSION.create_execution_ctx()), - ); - bencher .with_inputs(|| (array(), SESSION.create_execution_ctx())) .bench_values(|(array, mut ctx)| { diff --git a/vortex-array/benches/varbinview_zip.rs b/vortex-array/benches/varbinview_zip.rs index e010291e9dc..b2d55b1b60d 100644 --- a/vortex-array/benches/varbinview_zip.rs +++ b/vortex-array/benches/varbinview_zip.rs @@ -9,6 +9,7 @@ use divan::Bencher; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::VarBinViewArray; use vortex_array::builtins::ArrayBuiltins; use vortex_array::dtype::DType; @@ -17,10 +18,11 @@ use vortex_mask::Mask; use vortex_session::VortexSession; fn main() { + LazyLock::force(&SESSION); divan::main(); } -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); /// Benchmarks zip on VarBinView arrays with a highly fragmented mask (worst case for per-slice lookup paths). #[divan::bench] diff --git a/vortex-array/src/test_harness.rs b/vortex-array/src/test_harness.rs index 98be3a85ce4..2524f4a05a4 100644 --- a/vortex-array/src/test_harness.rs +++ b/vortex-array/src/test_harness.rs @@ -7,10 +7,13 @@ use goldenfile::Mint; use goldenfile::differs::binary_diff; use itertools::Itertools; use vortex_error::VortexResult; +use vortex_session::SessionExt; use crate::ExecutionCtx; use crate::arrays::BoolArray; use crate::arrays::bool::BoolArrayExt; +use crate::optimizer::kernels::ArrayKernels; +use crate::optimizer::kernels::KernelSession; /// Check that a named metadata matches its previous versioning. /// diff --git a/vortex-compressor/benches/dict_encode.rs b/vortex-compressor/benches/dict_encode.rs index 2c4e24108a7..ec6343b6f40 100644 --- a/vortex-compressor/benches/dict_encode.rs +++ b/vortex-compressor/benches/dict_encode.rs @@ -8,6 +8,7 @@ use std::sync::LazyLock; use divan::Bencher; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::BoolArray; use vortex_array::arrays::PrimitiveArray; use vortex_array::builders::dict::dict_encode; @@ -15,7 +16,7 @@ use vortex_array::validity::Validity; use vortex_buffer::BufferMut; use vortex_session::VortexSession; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn make_array() -> PrimitiveArray { let values: BufferMut = (0..50).cycle().take(64_000).collect(); @@ -41,5 +42,6 @@ fn encode_generic(bencher: Bencher) { } fn main() { + LazyLock::force(&SESSION); divan::main() } diff --git a/vortex-row/benches/row_encode.rs b/vortex-row/benches/row_encode.rs index 0747c5facac..422f21088cc 100644 --- a/vortex-row/benches/row_encode.rs +++ b/vortex-row/benches/row_encode.rs @@ -30,9 +30,11 @@ use rand::distr::Alphanumeric; use rand::rngs::StdRng; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; +use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_array::arrays::StructArray; use vortex_array::arrays::VarBinViewArray; +use vortex_array::test_harness::WarmSession; use vortex_row::RowEncoder; use vortex_session::VortexSession; @@ -41,9 +43,10 @@ static GLOBAL: MiMalloc = MiMalloc; const N: usize = 100_000; -static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); +static SESSION: LazyLock = LazyLock::new(array_session); fn main() { + LazyLock::force(&SESSION); divan::main(); } diff --git a/vortex/benches/common_encoding_tree_throughput.rs b/vortex/benches/common_encoding_tree_throughput.rs index 1d1dcf86956..11a21a1c4a6 100644 --- a/vortex/benches/common_encoding_tree_throughput.rs +++ b/vortex/benches/common_encoding_tree_throughput.rs @@ -44,12 +44,15 @@ use vortex::encodings::runend::RunEnd; use vortex::encodings::runend::RunEndArrayExt; use vortex::error::VortexExpect; use vortex::extension::datetime::TimeUnit; +use vortex_array::optimizer::kernels::KernelSession; +use vortex_session::SessionExt; use vortex_session::VortexSession; #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; fn main() { + LazyLock::force(&SESSION); divan::main(); } diff --git a/vortex/benches/single_encoding_throughput.rs b/vortex/benches/single_encoding_throughput.rs index b75f832a7a1..953fddf4bc0 100644 --- a/vortex/benches/single_encoding_throughput.rs +++ b/vortex/benches/single_encoding_throughput.rs @@ -39,8 +39,10 @@ use vortex::encodings::zigzag::zigzag_encode; use vortex::encodings::zstd::Zstd; use vortex::encodings::zstd::ZstdData; use vortex_array::VortexSessionExecute; +use vortex_array::optimizer::kernels::ArrayKernels; use vortex_error::VortexResult; use vortex_sequence::Sequence; +use vortex_session::SessionExt; use vortex_session::VortexSession; #[global_allocator] @@ -49,6 +51,7 @@ static GLOBAL: MiMalloc = MiMalloc; static SESSION: LazyLock = LazyLock::new(VortexSession::default); fn main() { + LazyLock::force(&SESSION); divan::main(); } From 61f8f1437b7b2cc7abc668dbb500157e7b40837b Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Fri, 3 Jul 2026 15:58:42 +0100 Subject: [PATCH 2/2] fix Signed-off-by: Robert Kruszewski --- vortex-array/benches/primitive_zip.rs | 2 +- vortex-array/benches/scalar_subtract.rs | 2 +- vortex-array/src/test_harness.rs | 3 --- vortex-row/benches/row_encode.rs | 1 - vortex/benches/common_encoding_tree_throughput.rs | 2 -- vortex/benches/single_encoding_throughput.rs | 2 -- 6 files changed, 2 insertions(+), 10 deletions(-) diff --git a/vortex-array/benches/primitive_zip.rs b/vortex-array/benches/primitive_zip.rs index dbebd534686..93e83b372dc 100644 --- a/vortex-array/benches/primitive_zip.rs +++ b/vortex-array/benches/primitive_zip.rs @@ -9,8 +9,8 @@ use std::sync::LazyLock; -use arrow_array::ArrayRef; use divan::Bencher; +use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; diff --git a/vortex-array/benches/scalar_subtract.rs b/vortex-array/benches/scalar_subtract.rs index bce530a90ac..ef004d2e270 100644 --- a/vortex-array/benches/scalar_subtract.rs +++ b/vortex-array/benches/scalar_subtract.rs @@ -5,7 +5,6 @@ use std::sync::LazyLock; -use arrow_array::Scalar; use divan::Bencher; use rand::RngExt; use rand::SeedableRng; @@ -18,6 +17,7 @@ use vortex_array::array_session; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::ConstantArray; use vortex_array::builtins::ArrayBuiltins; +use vortex_array::scalar::Scalar; use vortex_array::scalar_fn::fns::operators::Operator; use vortex_buffer::Buffer; use vortex_session::VortexSession; diff --git a/vortex-array/src/test_harness.rs b/vortex-array/src/test_harness.rs index 2524f4a05a4..98be3a85ce4 100644 --- a/vortex-array/src/test_harness.rs +++ b/vortex-array/src/test_harness.rs @@ -7,13 +7,10 @@ use goldenfile::Mint; use goldenfile::differs::binary_diff; use itertools::Itertools; use vortex_error::VortexResult; -use vortex_session::SessionExt; use crate::ExecutionCtx; use crate::arrays::BoolArray; use crate::arrays::bool::BoolArrayExt; -use crate::optimizer::kernels::ArrayKernels; -use crate::optimizer::kernels::KernelSession; /// Check that a named metadata matches its previous versioning. /// diff --git a/vortex-row/benches/row_encode.rs b/vortex-row/benches/row_encode.rs index 422f21088cc..deea043280b 100644 --- a/vortex-row/benches/row_encode.rs +++ b/vortex-row/benches/row_encode.rs @@ -34,7 +34,6 @@ use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_array::arrays::StructArray; use vortex_array::arrays::VarBinViewArray; -use vortex_array::test_harness::WarmSession; use vortex_row::RowEncoder; use vortex_session::VortexSession; diff --git a/vortex/benches/common_encoding_tree_throughput.rs b/vortex/benches/common_encoding_tree_throughput.rs index 11a21a1c4a6..65c2c1bc040 100644 --- a/vortex/benches/common_encoding_tree_throughput.rs +++ b/vortex/benches/common_encoding_tree_throughput.rs @@ -44,8 +44,6 @@ use vortex::encodings::runend::RunEnd; use vortex::encodings::runend::RunEndArrayExt; use vortex::error::VortexExpect; use vortex::extension::datetime::TimeUnit; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_session::SessionExt; use vortex_session::VortexSession; #[global_allocator] diff --git a/vortex/benches/single_encoding_throughput.rs b/vortex/benches/single_encoding_throughput.rs index 953fddf4bc0..ca0a8926233 100644 --- a/vortex/benches/single_encoding_throughput.rs +++ b/vortex/benches/single_encoding_throughput.rs @@ -39,10 +39,8 @@ use vortex::encodings::zigzag::zigzag_encode; use vortex::encodings::zstd::Zstd; use vortex::encodings::zstd::ZstdData; use vortex_array::VortexSessionExecute; -use vortex_array::optimizer::kernels::ArrayKernels; use vortex_error::VortexResult; use vortex_sequence::Sequence; -use vortex_session::SessionExt; use vortex_session::VortexSession; #[global_allocator]