From f53acf75807e9ffdcbdbd79b525ab181cc99e617 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 20 Sep 2026 16:22:14 +0000 Subject: [PATCH] Use mimalloc as the global allocator in every benchmark binary Twenty-two benchmark binaries already used mimalloc, on the advice of the benchmarking guide; the other 81 used the system allocator, whose cost depends on state that differs between runner images and between runs. Several simulation benchmarks that allocate inside the timed region flipped between two values on pull requests that could not have affected them, among them split_collection's cold_misaligned, fsst_compress's compress_fsst, and take_chunked's repeated-index case. Give every benchmark binary the same allocator, add the workspace mimalloc dev-dependency to the 16 crates that lacked it, and make the guide's recommendation a rule. The CUDA and DuckDB benchmarks are left alone: they run on different legs and link C++ code. Signed-off-by: Claude --- Cargo.lock | 16 ++++++++++++++++ docs/developer-guide/benchmarking.md | 12 +++++++++--- encodings/alp/Cargo.toml | 1 + encodings/alp/benches/alp_compress.rs | 4 ++++ encodings/datetime-parts/Cargo.toml | 1 + .../datetime-parts/benches/split_temporal.rs | 4 ++++ encodings/decimal-byte-parts/Cargo.toml | 1 + .../decimal-byte-parts/benches/dbp_assemble.rs | 4 ++++ .../decimal-byte-parts/benches/dbp_split.rs | 4 ++++ encodings/fastlanes/Cargo.toml | 1 + encodings/fastlanes/benches/bitpack_compare.rs | 4 ++++ .../fastlanes/benches/bitpack_compare_sweep.rs | 4 ++++ encodings/fastlanes/benches/bitpacking_take.rs | 4 ++++ .../fastlanes/benches/canonicalize_bench.rs | 4 ++++ encodings/fastlanes/benches/cast_bitpacked.rs | 4 ++++ encodings/fastlanes/benches/compute_between.rs | 4 ++++ encodings/fsst/Cargo.toml | 1 + .../fsst/benches/chunked_dict_fsst_builder.rs | 4 ++++ encodings/fsst/benches/fsst_compress.rs | 4 ++++ encodings/fsst/benches/fsst_like.rs | 4 ++++ encodings/fsst/benches/fsst_url_compare.rs | 4 ++++ encodings/onpair/Cargo.toml | 1 + encodings/onpair/benches/decode.rs | 4 ++++ encodings/pco/Cargo.toml | 1 + encodings/pco/benches/scalar.rs | 4 ++++ encodings/runend/benches/run_end_decode.rs | 4 ++++ encodings/runend/benches/run_end_filter.rs | 4 ++++ encodings/runend/benches/run_end_null_count.rs | 4 ++++ encodings/runend/benches/run_end_sum.rs | 4 ++++ encodings/runend/benches/run_end_take.rs | 4 ++++ encodings/sparse/Cargo.toml | 1 + encodings/sparse/benches/sparse_canonical.rs | 4 ++++ encodings/sparse/benches/sparse_pushdown.rs | 4 ++++ vortex-array/benches/aggregate_grouped.rs | 4 ++++ vortex-array/benches/aggregate_max.rs | 4 ++++ vortex-array/benches/aggregate_sum.rs | 4 ++++ vortex-array/benches/bool_zip.rs | 4 ++++ vortex-array/benches/cast_primitive.rs | 4 ++++ vortex-array/benches/chunked_dict_builder.rs | 4 ++++ vortex-array/benches/chunked_fsl_canonicalize.rs | 4 ++++ vortex-array/benches/dict_compare.rs | 4 ++++ vortex-array/benches/dict_mask.rs | 4 ++++ vortex-array/benches/dict_unreferenced_mask.rs | 4 ++++ vortex-array/benches/filter_bool.rs | 4 ++++ vortex-array/benches/filter_list.rs | 4 ++++ vortex-array/benches/interleave.rs | 4 ++++ vortex-array/benches/kleene_bool.rs | 4 ++++ vortex-array/benches/like.rs | 4 ++++ vortex-array/benches/list_length.rs | 4 ++++ vortex-array/benches/list_sum.rs | 4 ++++ vortex-array/benches/listview_builder_extend.rs | 4 ++++ vortex-array/benches/listview_rebuild.rs | 4 ++++ vortex-array/benches/listview_zip.rs | 4 ++++ vortex-array/benches/patches_lookup.rs | 4 ++++ .../benches/piecewise_sequence_take_primitive.rs | 4 ++++ vortex-array/benches/primitive_zip.rs | 4 ++++ vortex-array/benches/scalar_at_struct.rs | 4 ++++ vortex-array/benches/scalar_subtract.rs | 4 ++++ vortex-array/benches/search_sorted.rs | 4 ++++ vortex-array/benches/slice_dict_primitive.rs | 4 ++++ vortex-array/benches/take_chunked.rs | 4 ++++ 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 ++++ .../benches/take_slices_to_buffer_matrix.rs | 4 ++++ vortex-array/benches/take_struct.rs | 4 ++++ vortex-array/benches/take_varbin.rs | 4 ++++ vortex-array/benches/validity_is_valid.rs | 4 ++++ vortex-array/benches/varbinview_zip.rs | 4 ++++ vortex-arrow/Cargo.toml | 1 + vortex-arrow/benches/to_arrow.rs | 4 ++++ vortex-btrblocks/Cargo.toml | 1 + vortex-btrblocks/benches/compress.rs | 5 +++++ vortex-btrblocks/benches/compress_listview.rs | 5 +++++ vortex-buffer/Cargo.toml | 1 + vortex-buffer/benches/allocation.rs | 4 ++++ vortex-buffer/benches/collect_bool.rs | 4 ++++ vortex-buffer/benches/cpu_dispatch.rs | 4 ++++ vortex-buffer/benches/vortex_bitbuffer.rs | 4 ++++ vortex-buffer/benches/vortex_buffer.rs | 4 ++++ vortex-compressor/Cargo.toml | 1 + vortex-compressor/benches/dict_encode.rs | 4 ++++ vortex-compressor/benches/stats_calc.rs | 5 +++++ vortex-compute/Cargo.toml | 1 + vortex-compute/benches/lane_kernels.rs | 4 ++++ vortex-file/Cargo.toml | 1 + vortex-file/benches/split_collection.rs | 4 ++++ vortex-layout/Cargo.toml | 1 + vortex-layout/benches/aggregate_partial_merge.rs | 4 ++++ vortex-layout/benches/bloom_filter.rs | 4 ++++ vortex-layout/benches/zone_map_prune.rs | 4 ++++ vortex-mask/Cargo.toml | 1 + vortex-mask/benches/intersect_by_rank.rs | 4 ++++ vortex-mask/benches/mask_iteration.rs | 4 ++++ vortex-mask/benches/rank.rs | 4 ++++ vortex-mask/benches/valid_counts.rs | 4 ++++ vortex/benches/pipeline.rs | 4 ++++ vortex/benches/take_union.rs | 4 ++++ 99 files changed, 368 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca9cd626f1b..04877144d07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10598,6 +10598,7 @@ dependencies = [ "alp", "codspeed-divan-compat", "itertools 0.14.0", + "mimalloc", "num-traits", "prost 0.14.4", "rand 0.10.2", @@ -10694,6 +10695,7 @@ dependencies = [ "arrow-select 59.3.0", "codspeed-divan-compat", "itertools 0.14.0", + "mimalloc", "num-traits", "rstest", "simdutf8", @@ -10786,6 +10788,7 @@ dependencies = [ "codspeed-divan-compat", "insta", "itertools 0.14.0", + "mimalloc", "pco", "rand 0.10.2", "rstest", @@ -10826,6 +10829,7 @@ dependencies = [ "codspeed-divan-compat", "itertools 0.14.0", "memmap2", + "mimalloc", "num-traits", "rstest", "serde", @@ -10911,6 +10915,7 @@ version = "0.1.0" dependencies = [ "codspeed-divan-compat", "itertools 0.14.0", + "mimalloc", "num-traits", "parking_lot", "rand 0.10.2", @@ -10934,6 +10939,7 @@ dependencies = [ "arrow-cast 59.3.0", "arrow-schema 59.3.0", "codspeed-divan-compat", + "mimalloc", "num-traits", "rand 0.10.2", "vortex-bench-support", @@ -11047,6 +11053,7 @@ name = "vortex-datetime-parts" version = "0.1.0" dependencies = [ "codspeed-divan-compat", + "mimalloc", "num-traits", "prost 0.14.4", "rand 0.10.2", @@ -11064,6 +11071,7 @@ version = "0.1.0" dependencies = [ "codspeed-divan-compat", "hegeltest", + "mimalloc", "num-traits", "prost 0.14.4", "rand 0.10.2", @@ -11145,6 +11153,7 @@ dependencies = [ "fastlanes 0.7.2", "itertools 0.14.0", "lending-iterator", + "mimalloc", "num-traits", "prost 0.14.4", "rand 0.10.2", @@ -11194,6 +11203,7 @@ dependencies = [ "futures", "itertools 0.14.0", "kanal", + "mimalloc", "moka", "object_store", "parking_lot", @@ -11237,6 +11247,7 @@ version = "0.1.0" dependencies = [ "codspeed-divan-compat", "fsst-rs", + "mimalloc", "num-traits", "prost 0.14.4", "rand 0.10.2", @@ -11384,6 +11395,7 @@ dependencies = [ "insta", "itertools 0.14.0", "kanal", + "mimalloc", "moka", "once_cell", "parking_lot", @@ -11422,6 +11434,7 @@ version = "0.1.0" dependencies = [ "codspeed-divan-compat", "itertools 0.14.0", + "mimalloc", "rstest", "serde", "vortex-buffer", @@ -11453,6 +11466,7 @@ name = "vortex-onpair" version = "0.1.0" dependencies = [ "codspeed-divan-compat", + "mimalloc", "num-traits", "onpair", "prost 0.14.4", @@ -11495,6 +11509,7 @@ name = "vortex-pco" version = "0.1.0" dependencies = [ "codspeed-divan-compat", + "mimalloc", "pco", "prost 0.14.4", "rstest", @@ -11637,6 +11652,7 @@ version = "0.1.0" dependencies = [ "codspeed-divan-compat", "itertools 0.14.0", + "mimalloc", "num-traits", "prost 0.14.4", "rstest", diff --git a/docs/developer-guide/benchmarking.md b/docs/developer-guide/benchmarking.md index 0e2b59d0067..ef6f8127ca1 100644 --- a/docs/developer-guide/benchmarking.md +++ b/docs/developer-guide/benchmarking.md @@ -182,10 +182,9 @@ trace — including cache and memory access costs. This has several implications [walltime instrument](https://codspeed.io/docs/instruments/walltime) or be gated with `#[cfg(not(codspeed))]`. -### Prefer `mimalloc` for throughput benchmarks +### Use `mimalloc` as the global allocator -Throughput benchmarks should use `mimalloc` as the global allocator to reduce system allocator -noise: +Every benchmark binary uses `mimalloc` as its global allocator: ```rust use mimalloc::MiMalloc; @@ -193,6 +192,13 @@ use mimalloc::MiMalloc; static GLOBAL: MiMalloc = MiMalloc; ``` +The system allocator's cost depends on its state, which differs between runner images and between +runs, so allocation inside a timed region made several simulation benchmarks flip between two +values on pull requests that could not have affected them. `mimalloc` does the same work every +time, and one allocator for every binary means no benchmark measures a different allocator from +its neighbours. Add the two lines to every new benchmark file; each crate with benchmarks already +has the `mimalloc` dev-dependency. + ## SQL Benchmarks SQL benchmarks measure end-to-end query performance across different engines and file formats. diff --git a/encodings/alp/Cargo.toml b/encodings/alp/Cargo.toml index d870a0fe0cf..7da81b60d99 100644 --- a/encodings/alp/Cargo.toml +++ b/encodings/alp/Cargo.toml @@ -30,6 +30,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } diff --git a/encodings/alp/benches/alp_compress.rs b/encodings/alp/benches/alp_compress.rs index 4af17372e22..fd9d92a47d3 100644 --- a/encodings/alp/benches/alp_compress.rs +++ b/encodings/alp/benches/alp_compress.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng as _; use rand::rngs::StdRng; @@ -25,6 +26,9 @@ use vortex_buffer::Buffer; use vortex_buffer::buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/datetime-parts/Cargo.toml b/encodings/datetime-parts/Cargo.toml index 3bbdde465dd..19f2490573a 100644 --- a/encodings/datetime-parts/Cargo.toml +++ b/encodings/datetime-parts/Cargo.toml @@ -27,6 +27,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } diff --git a/encodings/datetime-parts/benches/split_temporal.rs b/encodings/datetime-parts/benches/split_temporal.rs index 213192899fd..0b079972e95 100644 --- a/encodings/datetime-parts/benches/split_temporal.rs +++ b/encodings/datetime-parts/benches/split_temporal.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng as _; use rand::rngs::StdRng; @@ -19,6 +20,9 @@ use vortex_buffer::Buffer; use vortex_datetime_parts::split_temporal; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/decimal-byte-parts/Cargo.toml b/encodings/decimal-byte-parts/Cargo.toml index e5d15c2c4f7..6c3312be43f 100644 --- a/encodings/decimal-byte-parts/Cargo.toml +++ b/encodings/decimal-byte-parts/Cargo.toml @@ -28,6 +28,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } hegeltest = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } vortex-array = { path = "../../vortex-array", features = ["_test-harness"] } diff --git a/encodings/decimal-byte-parts/benches/dbp_assemble.rs b/encodings/decimal-byte-parts/benches/dbp_assemble.rs index 48161a2c664..be2f205be0d 100644 --- a/encodings/decimal-byte-parts/benches/dbp_assemble.rs +++ b/encodings/decimal-byte-parts/benches/dbp_assemble.rs @@ -8,6 +8,7 @@ mod common; use divan::Bencher; use divan::black_box; +use mimalloc::MiMalloc; use vortex_array::dtype::DecimalType; use vortex_array::dtype::i256; use vortex_buffer::buffer; @@ -22,6 +23,9 @@ use crate::common::cases; use crate::common::i128_values; use crate::common::i256_values; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/decimal-byte-parts/benches/dbp_split.rs b/encodings/decimal-byte-parts/benches/dbp_split.rs index dd5b9abcf13..d3a6100f500 100644 --- a/encodings/decimal-byte-parts/benches/dbp_split.rs +++ b/encodings/decimal-byte-parts/benches/dbp_split.rs @@ -8,6 +8,7 @@ mod common; use divan::Bencher; use divan::black_box; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -22,6 +23,9 @@ use crate::common::cases; use crate::common::i128_values; use crate::common::i256_values; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/Cargo.toml b/encodings/fastlanes/Cargo.toml index 9085390b67b..ac626a9e98c 100644 --- a/encodings/fastlanes/Cargo.toml +++ b/encodings/fastlanes/Cargo.toml @@ -35,6 +35,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } itertools = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } vortex-alp = { path = "../alp" } diff --git a/encodings/fastlanes/benches/bitpack_compare.rs b/encodings/fastlanes/benches/bitpack_compare.rs index 739fcd72dc6..ecac3446d8e 100644 --- a/encodings/fastlanes/benches/bitpack_compare.rs +++ b/encodings/fastlanes/benches/bitpack_compare.rs @@ -14,6 +14,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::ExecutionCtx; use vortex_array::IntoArray; @@ -31,6 +32,9 @@ use vortex_fastlanes::BitPackedArray; use vortex_fastlanes::BitPackedData; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/benches/bitpack_compare_sweep.rs b/encodings/fastlanes/benches/bitpack_compare_sweep.rs index ec7cf9b6892..1d1f91f7671 100644 --- a/encodings/fastlanes/benches/bitpack_compare_sweep.rs +++ b/encodings/fastlanes/benches/bitpack_compare_sweep.rs @@ -16,6 +16,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::ExecutionCtx; use vortex_array::IntoArray; @@ -35,6 +36,9 @@ use vortex_fastlanes::BitPackedArray; use vortex_fastlanes::BitPackedData; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/benches/bitpacking_take.rs b/encodings/fastlanes/benches/bitpacking_take.rs index eb072017ae3..fd1b70d2b8d 100644 --- a/encodings/fastlanes/benches/bitpacking_take.rs +++ b/encodings/fastlanes/benches/bitpacking_take.rs @@ -7,6 +7,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -22,6 +23,9 @@ use vortex_fastlanes::BitPackedArrayExt; use vortex_fastlanes::bitpack_compress::bitpack_to_best_bit_width; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/benches/canonicalize_bench.rs b/encodings/fastlanes/benches/canonicalize_bench.rs index 7d8d7abb659..2c47656f836 100644 --- a/encodings/fastlanes/benches/canonicalize_bench.rs +++ b/encodings/fastlanes/benches/canonicalize_bench.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::SeedableRng; use rand::prelude::StdRng; use vortex_array::Canonical; @@ -16,6 +17,9 @@ use vortex_error::VortexExpect; use vortex_fastlanes::bitpack_compress::test_harness::make_array; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/benches/cast_bitpacked.rs b/encodings/fastlanes/benches/cast_bitpacked.rs index 62c6c5533c3..bd9d6d9f24f 100644 --- a/encodings/fastlanes/benches/cast_bitpacked.rs +++ b/encodings/fastlanes/benches/cast_bitpacked.rs @@ -15,6 +15,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::prelude::StdRng; @@ -34,6 +35,9 @@ use vortex_fastlanes::BitPackedArray; use vortex_fastlanes::BitPackedData; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fastlanes/benches/compute_between.rs b/encodings/fastlanes/benches/compute_between.rs index 2b295157e68..ef09c7b25e3 100644 --- a/encodings/fastlanes/benches/compute_between.rs +++ b/encodings/fastlanes/benches/compute_between.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; +use mimalloc::MiMalloc; use num_traits::NumCast; use rand::RngExt; use rand::rngs::StdRng; @@ -20,6 +21,9 @@ use vortex_error::VortexExpect; use vortex_fastlanes::bitpack_compress::bitpack_to_best_bit_width; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fsst/Cargo.toml b/encodings/fsst/Cargo.toml index f749f121efa..0603eee0519 100644 --- a/encodings/fsst/Cargo.toml +++ b/encodings/fsst/Cargo.toml @@ -32,6 +32,7 @@ _test-harness = ["dep:rand", "vortex-array/_test-harness"] [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } test-with = { workspace = true } diff --git a/encodings/fsst/benches/chunked_dict_fsst_builder.rs b/encodings/fsst/benches/chunked_dict_fsst_builder.rs index de25bf274b6..b19e03546c2 100644 --- a/encodings/fsst/benches/chunked_dict_fsst_builder.rs +++ b/encodings/fsst/benches/chunked_dict_fsst_builder.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::Canonical; use vortex_array::IntoArray; @@ -15,6 +16,9 @@ use vortex_error::VortexExpect; use vortex_fsst::test_utils::gen_dict_fsst_test_data; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fsst/benches/fsst_compress.rs b/encodings/fsst/benches/fsst_compress.rs index ea6d9f7c544..1b7fe8d6e0a 100644 --- a/encodings/fsst/benches/fsst_compress.rs +++ b/encodings/fsst/benches/fsst_compress.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -28,6 +29,9 @@ use vortex_fsst::fsst_compress; use vortex_fsst::fsst_train_compressor; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fsst/benches/fsst_like.rs b/encodings/fsst/benches/fsst_like.rs index 0737100602b..d85f0666aec 100644 --- a/encodings/fsst/benches/fsst_like.rs +++ b/encodings/fsst/benches/fsst_like.rs @@ -7,6 +7,7 @@ use std::fmt; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -24,6 +25,9 @@ use vortex_fsst::test_utils::make_fsst_rare_match; use vortex_fsst::test_utils::make_fsst_short_urls; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/fsst/benches/fsst_url_compare.rs b/encodings/fsst/benches/fsst_url_compare.rs index 9ff4e3debd5..6122daa263b 100644 --- a/encodings/fsst/benches/fsst_url_compare.rs +++ b/encodings/fsst/benches/fsst_url_compare.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -28,6 +29,9 @@ use vortex_fsst::test_utils::NUM_STRINGS; use vortex_fsst::test_utils::generate_url_data; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/onpair/Cargo.toml b/encodings/onpair/Cargo.toml index 2f6b19147fb..4d782caa6d9 100644 --- a/encodings/onpair/Cargo.toml +++ b/encodings/onpair/Cargo.toml @@ -31,6 +31,7 @@ _test-harness = ["vortex-array/_test-harness"] [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } diff --git a/encodings/onpair/benches/decode.rs b/encodings/onpair/benches/decode.rs index 57debb32090..c04505baf37 100644 --- a/encodings/onpair/benches/decode.rs +++ b/encodings/onpair/benches/decode.rs @@ -28,6 +28,7 @@ use std::mem::MaybeUninit; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use onpair::CompactDictionaryView; use vortex_array::ArrayRef; use vortex_array::ExecutionCtx; @@ -258,6 +259,9 @@ fn filter_share_dict(bencher: Bencher, case: (Shape, usize)) { }); } +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/pco/Cargo.toml b/encodings/pco/Cargo.toml index 749464c865c..ded53693070 100644 --- a/encodings/pco/Cargo.toml +++ b/encodings/pco/Cargo.toml @@ -27,6 +27,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } vortex-arrow = { workspace = true } diff --git a/encodings/pco/benches/scalar.rs b/encodings/pco/benches/scalar.rs index eff55fceb8c..7a75fbb4d6d 100644 --- a/encodings/pco/benches/scalar.rs +++ b/encodings/pco/benches/scalar.rs @@ -7,6 +7,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -16,6 +17,9 @@ use vortex_error::VortexExpect; use vortex_pco::Pco; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/runend/benches/run_end_decode.rs b/encodings/runend/benches/run_end_decode.rs index 9256a4b3a53..3ca4544312d 100644 --- a/encodings/runend/benches/run_end_decode.rs +++ b/encodings/runend/benches/run_end_decode.rs @@ -7,6 +7,7 @@ use std::fmt; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::VortexSessionExecute; use vortex_array::arrays::BoolArray; use vortex_array::arrays::PrimitiveArray; @@ -16,6 +17,9 @@ use vortex_buffer::BufferMut; use vortex_runend::decompress_bool::runend_decode_bools; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/runend/benches/run_end_filter.rs b/encodings/runend/benches/run_end_filter.rs index 395b41063b1..b012d43ca7d 100644 --- a/encodings/runend/benches/run_end_filter.rs +++ b/encodings/runend/benches/run_end_filter.rs @@ -16,12 +16,16 @@ use std::fmt; use divan::Bencher; +use mimalloc::MiMalloc; use rand::SeedableRng; use rand::rngs::StdRng; use rand::seq::SliceRandom; use vortex_buffer::BitBuffer; use vortex_runend::_benchmarking::filter_run_end_primitive; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/runend/benches/run_end_null_count.rs b/encodings/runend/benches/run_end_null_count.rs index 46d8710c38c..af4d1e2fbb2 100644 --- a/encodings/runend/benches/run_end_null_count.rs +++ b/encodings/runend/benches/run_end_null_count.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -17,6 +18,9 @@ use vortex_runend::RunEnd; use vortex_runend::RunEndArray; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/runend/benches/run_end_sum.rs b/encodings/runend/benches/run_end_sum.rs index 9132d425c48..d5a7b338922 100644 --- a/encodings/runend/benches/run_end_sum.rs +++ b/encodings/runend/benches/run_end_sum.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -23,6 +24,9 @@ static SESSION: LazyLock = LazyLock::new(|| { session }); +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/encodings/runend/benches/run_end_take.rs b/encodings/runend/benches/run_end_take.rs index f0dccccfc48..910f43b98c9 100644 --- a/encodings/runend/benches/run_end_take.rs +++ b/encodings/runend/benches/run_end_take.rs @@ -7,6 +7,7 @@ use std::fmt; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -20,6 +21,9 @@ use vortex_buffer::Buffer; use vortex_runend::RunEnd; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/sparse/Cargo.toml b/encodings/sparse/Cargo.toml index 56e87745b77..8f5db518478 100644 --- a/encodings/sparse/Cargo.toml +++ b/encodings/sparse/Cargo.toml @@ -29,6 +29,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } itertools = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } vortex-arrow = { workspace = true } diff --git a/encodings/sparse/benches/sparse_canonical.rs b/encodings/sparse/benches/sparse_canonical.rs index 27f7340fb91..03168c42f5d 100644 --- a/encodings/sparse/benches/sparse_canonical.rs +++ b/encodings/sparse/benches/sparse_canonical.rs @@ -7,6 +7,7 @@ use std::sync::Arc; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::Canonical; use vortex_array::IntoArray; @@ -23,6 +24,9 @@ use vortex_error::VortexExpect; use vortex_session::VortexSession; use vortex_sparse::Sparse; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/encodings/sparse/benches/sparse_pushdown.rs b/encodings/sparse/benches/sparse_pushdown.rs index a066e196d76..dea4f94a832 100644 --- a/encodings/sparse/benches/sparse_pushdown.rs +++ b/encodings/sparse/benches/sparse_pushdown.rs @@ -14,6 +14,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::Canonical; use vortex_array::ExecutionCtx; @@ -37,6 +38,9 @@ use vortex_error::VortexExpect; use vortex_session::VortexSession; use vortex_sparse::Sparse; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/aggregate_grouped.rs b/vortex-array/benches/aggregate_grouped.rs index 64820997778..f4bf7e39ad5 100644 --- a/vortex-array/benches/aggregate_grouped.rs +++ b/vortex-array/benches/aggregate_grouped.rs @@ -7,6 +7,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -29,6 +30,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/aggregate_max.rs b/vortex-array/benches/aggregate_max.rs index 20677522b10..92274a70e5f 100644 --- a/vortex-array/benches/aggregate_max.rs +++ b/vortex-array/benches/aggregate_max.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::prelude::*; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -11,6 +12,9 @@ use vortex_array::array_session; use vortex_array::arrays::PrimitiveArray; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/aggregate_sum.rs b/vortex-array/benches/aggregate_sum.rs index 31856e22f9f..7213745e5bb 100644 --- a/vortex-array/benches/aggregate_sum.rs +++ b/vortex-array/benches/aggregate_sum.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::prelude::*; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -13,6 +14,9 @@ use vortex_array::arrays::PrimitiveArray; use vortex_array::expr::stats::Stat; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/bool_zip.rs b/vortex-array/benches/bool_zip.rs index d1fc96c457e..1012cd7207e 100644 --- a/vortex-array/benches/bool_zip.rs +++ b/vortex-array/benches/bool_zip.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -16,6 +17,9 @@ use vortex_array::builtins::ArrayBuiltins; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/cast_primitive.rs b/vortex-array/benches/cast_primitive.rs index 5ffc7ba3f39..7d0a96ce42b 100644 --- a/vortex-array/benches/cast_primitive.rs +++ b/vortex-array/benches/cast_primitive.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::prelude::*; use vortex_array::Canonical; use vortex_array::IntoArray; @@ -20,6 +21,9 @@ use vortex_array::dtype::PType; use vortex_array::expr::stats::Stat; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/chunked_dict_builder.rs b/vortex-array/benches/chunked_dict_builder.rs index 41fc16b19e8..af0afb45287 100644 --- a/vortex-array/benches/chunked_dict_builder.rs +++ b/vortex-array/benches/chunked_dict_builder.rs @@ -4,6 +4,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::distr::Distribution; use rand::distr::StandardUniform; use vortex_array::Canonical; @@ -14,6 +15,9 @@ use vortex_array::dtype::NativePType; use vortex_error::VortexExpect; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + 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 3718e756456..5c980b5dd58 100644 --- a/vortex-array/benches/chunked_fsl_canonicalize.rs +++ b/vortex-array/benches/chunked_fsl_canonicalize.rs @@ -13,6 +13,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -23,6 +24,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/dict_compare.rs b/vortex-array/benches/dict_compare.rs index adf7e3cfb49..1ca0899923e 100644 --- a/vortex-array/benches/dict_compare.rs +++ b/vortex-array/benches/dict_compare.rs @@ -5,6 +5,7 @@ use std::sync::LazyLock; +use mimalloc::MiMalloc; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -24,6 +25,9 @@ use vortex_array::expr::root; use vortex_array::scalar_fn::fns::operators::Operator; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/dict_mask.rs b/vortex-array/benches/dict_mask.rs index 35e1654fabc..0497b3a0068 100644 --- a/vortex-array/benches/dict_mask.rs +++ b/vortex-array/benches/dict_mask.rs @@ -4,6 +4,7 @@ #![expect(clippy::unwrap_used)] use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -15,6 +16,9 @@ use vortex_array::arrays::PrimitiveArray; use vortex_array::builtins::ArrayBuiltins; use vortex_mask::Mask; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/dict_unreferenced_mask.rs b/vortex-array/benches/dict_unreferenced_mask.rs index ee06b7d44a4..aa342e587ce 100644 --- a/vortex-array/benches/dict_unreferenced_mask.rs +++ b/vortex-array/benches/dict_unreferenced_mask.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -19,6 +20,9 @@ use vortex_session::VortexSession; static SESSION: LazyLock = LazyLock::new(array_session); +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/filter_bool.rs b/vortex-array/benches/filter_bool.rs index 20782a539b8..27a419e8f66 100644 --- a/vortex-array/benches/filter_bool.rs +++ b/vortex-array/benches/filter_bool.rs @@ -14,6 +14,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::prelude::*; use rand_distr::Zipf; use vortex_array::RecursiveCanonical; @@ -24,6 +25,9 @@ use vortex_buffer::BitBuffer; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/filter_list.rs b/vortex-array/benches/filter_list.rs index bbe38839728..eec61993794 100644 --- a/vortex-array/benches/filter_list.rs +++ b/vortex-array/benches/filter_list.rs @@ -8,6 +8,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -20,6 +21,9 @@ use vortex_buffer::Buffer; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/interleave.rs b/vortex-array/benches/interleave.rs index a04267c0d92..8da63e9655b 100644 --- a/vortex-array/benches/interleave.rs +++ b/vortex-array/benches/interleave.rs @@ -16,6 +16,7 @@ use std::fmt::Display; use std::fmt::Formatter; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -31,6 +32,9 @@ use vortex_array::arrays::InterleaveArray; use vortex_array::arrays::PrimitiveArray; use vortex_buffer::Buffer; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/kleene_bool.rs b/vortex-array/benches/kleene_bool.rs index 60a0171a9b9..1f0bd2fb1d1 100644 --- a/vortex-array/benches/kleene_bool.rs +++ b/vortex-array/benches/kleene_bool.rs @@ -7,6 +7,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::Columnar; use vortex_array::IntoArray; @@ -22,6 +23,9 @@ use vortex_array::scalar_fn::fns::operators::Operator; use vortex_array::session::ArraySession; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/like.rs b/vortex-array/benches/like.rs index f618e226fd6..238341b66d1 100644 --- a/vortex-array/benches/like.rs +++ b/vortex-array/benches/like.rs @@ -4,6 +4,7 @@ #![expect(clippy::unwrap_used)] use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -17,6 +18,9 @@ use vortex_array::arrays::VarBinViewArray; use vortex_array::scalar_fn::fns::like::Like; use vortex_array::scalar_fn::fns::like::LikeOptions; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/list_length.rs b/vortex-array/benches/list_length.rs index 7312d7b84ef..c832d549d50 100644 --- a/vortex-array/benches/list_length.rs +++ b/vortex-array/benches/list_length.rs @@ -12,6 +12,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -30,6 +31,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/list_sum.rs b/vortex-array/benches/list_sum.rs index 4a2caf65c09..dac0b37e097 100644 --- a/vortex-array/benches/list_sum.rs +++ b/vortex-array/benches/list_sum.rs @@ -10,6 +10,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -29,6 +30,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/listview_builder_extend.rs b/vortex-array/benches/listview_builder_extend.rs index 821e49b37c2..92e0c95e54b 100644 --- a/vortex-array/benches/listview_builder_extend.rs +++ b/vortex-array/benches/listview_builder_extend.rs @@ -8,6 +8,7 @@ use std::sync::Arc; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; use vortex_array::array_session; @@ -21,6 +22,9 @@ use vortex_array::dtype::PType::I32; use vortex_array::validity::Validity; use vortex_buffer::Buffer; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/listview_rebuild.rs b/vortex-array/benches/listview_rebuild.rs index b1c1f7676ce..eba8181a570 100644 --- a/vortex-array/benches/listview_rebuild.rs +++ b/vortex-array/benches/listview_rebuild.rs @@ -9,6 +9,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::Canonical; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -26,6 +27,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/listview_zip.rs b/vortex-array/benches/listview_zip.rs index c50180a0e1a..5a5f3d86c8f 100644 --- a/vortex-array/benches/listview_zip.rs +++ b/vortex-array/benches/listview_zip.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -19,6 +20,9 @@ use vortex_buffer::BufferMut; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/patches_lookup.rs b/vortex-array/benches/patches_lookup.rs index 262e3144495..cce1d95af82 100644 --- a/vortex-array/benches/patches_lookup.rs +++ b/vortex-array/benches/patches_lookup.rs @@ -5,6 +5,7 @@ #![expect(clippy::cast_possible_truncation)] use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -13,6 +14,9 @@ use vortex_array::patches::PATCH_CHUNK_SIZE; use vortex_array::patches::Patches; use vortex_buffer::Buffer; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/piecewise_sequence_take_primitive.rs b/vortex-array/benches/piecewise_sequence_take_primitive.rs index 5933058caa6..f2417ae973b 100644 --- a/vortex-array/benches/piecewise_sequence_take_primitive.rs +++ b/vortex-array/benches/piecewise_sequence_take_primitive.rs @@ -14,6 +14,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::BytesCount; +use mimalloc::MiMalloc; use rand::SeedableRng; use rand::prelude::*; use vortex_array::ArrayRef; @@ -25,6 +26,9 @@ use vortex_array::arrays::PiecewiseSequenceArray; use vortex_array::arrays::PrimitiveArray; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/primitive_zip.rs b/vortex-array/benches/primitive_zip.rs index 93e83b372dc..ea36cba8114 100644 --- a/vortex-array/benches/primitive_zip.rs +++ b/vortex-array/benches/primitive_zip.rs @@ -10,6 +10,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -22,6 +23,9 @@ use vortex_buffer::BufferMut; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/scalar_at_struct.rs b/vortex-array/benches/scalar_at_struct.rs index 2564120f12e..4901028d0ed 100644 --- a/vortex-array/benches/scalar_at_struct.rs +++ b/vortex-array/benches/scalar_at_struct.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -20,6 +21,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/scalar_subtract.rs b/vortex-array/benches/scalar_subtract.rs index 50c0d903f20..de74f479bf0 100644 --- a/vortex-array/benches/scalar_subtract.rs +++ b/vortex-array/benches/scalar_subtract.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -22,6 +23,9 @@ use vortex_array::scalar_fn::fns::operators::Operator; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/search_sorted.rs b/vortex-array/benches/search_sorted.rs index 370290bf1c9..dd773460452 100644 --- a/vortex-array/benches/search_sorted.rs +++ b/vortex-array/benches/search_sorted.rs @@ -4,6 +4,7 @@ #![expect(clippy::unwrap_used)] use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -11,6 +12,9 @@ use rand::prelude::StdRng; use vortex_array::search_sorted::SearchSorted; use vortex_array::search_sorted::SearchSortedSide; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/slice_dict_primitive.rs b/vortex-array/benches/slice_dict_primitive.rs index 20a371e670e..297fa7ef1fa 100644 --- a/vortex-array/benches/slice_dict_primitive.rs +++ b/vortex-array/benches/slice_dict_primitive.rs @@ -5,6 +5,7 @@ #![expect(clippy::cast_possible_truncation)] use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::arrays::DictArray; @@ -12,6 +13,9 @@ use vortex_array::arrays::Primitive; use vortex_array::arrays::PrimitiveArray; use vortex_array::arrays::slice::SliceReduce; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/take_chunked.rs b/vortex-array/benches/take_chunked.rs index 3350030533e..77a08d1a90a 100644 --- a/vortex-array/benches/take_chunked.rs +++ b/vortex-array/benches/take_chunked.rs @@ -11,6 +11,7 @@ use std::fmt::Formatter; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; @@ -24,6 +25,9 @@ use vortex_array::dtype::FieldNames; use vortex_array::validity::Validity; use vortex_buffer::Buffer; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/take_filter.rs b/vortex-array/benches/take_filter.rs index 96852a91966..c5c8ae7fc5a 100644 --- a/vortex-array/benches/take_filter.rs +++ b/vortex-array/benches/take_filter.rs @@ -20,6 +20,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -38,6 +39,9 @@ use vortex_buffer::Buffer; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/take_fsl.rs b/vortex-array/benches/take_fsl.rs index 7a89f0eb47c..0d042dcf93a 100644 --- a/vortex-array/benches/take_fsl.rs +++ b/vortex-array/benches/take_fsl.rs @@ -15,6 +15,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::BytesCount; +use mimalloc::MiMalloc; use num_traits::FromPrimitive; use rand::RngExt; use rand::SeedableRng; @@ -40,6 +41,9 @@ use vortex_buffer::Buffer; use vortex_buffer::BufferMut; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/take_patches.rs b/vortex-array/benches/take_patches.rs index cae0176df89..395c275c7d3 100644 --- a/vortex-array/benches/take_patches.rs +++ b/vortex-array/benches/take_patches.rs @@ -7,6 +7,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -20,6 +21,9 @@ use vortex_buffer::Buffer; use vortex_error::VortexExpect; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/take_primitive.rs b/vortex-array/benches/take_primitive.rs index f796980ce5a..38ac41d7b97 100644 --- a/vortex-array/benches/take_primitive.rs +++ b/vortex-array/benches/take_primitive.rs @@ -10,6 +10,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use rand::distr::Uniform; use rand::prelude::*; use rand_distr::Zipf; @@ -21,6 +22,9 @@ use vortex_array::arrays::DictArray; use vortex_array::arrays::PrimitiveArray; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/take_slices_to_buffer_matrix.rs b/vortex-array/benches/take_slices_to_buffer_matrix.rs index 40813129dd6..09391306fdd 100644 --- a/vortex-array/benches/take_slices_to_buffer_matrix.rs +++ b/vortex-array/benches/take_slices_to_buffer_matrix.rs @@ -14,6 +14,7 @@ use divan::Bencher; use divan::counter::BytesCount; +use mimalloc::MiMalloc; use rand::SeedableRng; use rand::prelude::*; use rand_distr::Distribution; @@ -21,6 +22,9 @@ use rand_distr::Normal; use vortex_buffer::Buffer; use vortex_buffer::BufferMut; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/take_struct.rs b/vortex-array/benches/take_struct.rs index 9f7e518cb3a..7ea4d0cc0c5 100644 --- a/vortex-array/benches/take_struct.rs +++ b/vortex-array/benches/take_struct.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::distr::Uniform; @@ -20,6 +21,9 @@ use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/take_varbin.rs b/vortex-array/benches/take_varbin.rs index 77676dd50de..53ceb61f7da 100644 --- a/vortex-array/benches/take_varbin.rs +++ b/vortex-array/benches/take_varbin.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -19,6 +20,9 @@ use vortex_array::dtype::Nullability; use vortex_buffer::Buffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-array/benches/validity_is_valid.rs b/vortex-array/benches/validity_is_valid.rs index dc22fcb5478..892c5c60278 100644 --- a/vortex-array/benches/validity_is_valid.rs +++ b/vortex-array/benches/validity_is_valid.rs @@ -17,12 +17,16 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::VortexSessionExecute; use vortex_array::array_session; use vortex_array::validity::Validity; use vortex_buffer::BitBuffer; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-array/benches/varbinview_zip.rs b/vortex-array/benches/varbinview_zip.rs index caf72abf74f..8d2a4db076d 100644 --- a/vortex-array/benches/varbinview_zip.rs +++ b/vortex-array/benches/varbinview_zip.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::IntoArray; use vortex_array::RecursiveCanonical; use vortex_array::VortexSessionExecute; @@ -17,6 +18,9 @@ use vortex_array::dtype::Nullability; use vortex_mask::Mask; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-arrow/Cargo.toml b/vortex-arrow/Cargo.toml index 11f2308451c..ac02ae2a736 100644 --- a/vortex-arrow/Cargo.toml +++ b/vortex-arrow/Cargo.toml @@ -39,6 +39,7 @@ vortex-session = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } vortex-fsst = { workspace = true } diff --git a/vortex-arrow/benches/to_arrow.rs b/vortex-arrow/benches/to_arrow.rs index 1bac19f74e2..e0e037ae372 100644 --- a/vortex-arrow/benches/to_arrow.rs +++ b/vortex-arrow/benches/to_arrow.rs @@ -13,6 +13,7 @@ use arrow_schema::Field; use divan::Bencher; use divan::counter::ItemsCount; use itertools::iproduct; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::ExecutionCtx; use vortex_array::IntoArray; @@ -48,6 +49,9 @@ use vortex_onpair::onpair_compress; use vortex_session::VortexSession; use vortex_zstd::Zstd; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-btrblocks/Cargo.toml b/vortex-btrblocks/Cargo.toml index 0aa7e9669c3..24a03337768 100644 --- a/vortex-btrblocks/Cargo.toml +++ b/vortex-btrblocks/Cargo.toml @@ -42,6 +42,7 @@ vortex-zstd = { workspace = true, optional = true } arrow-array = { workspace = true } divan = { workspace = true } insta = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } test-with = { workspace = true } tpchgen = { workspace = true } diff --git a/vortex-btrblocks/benches/compress.rs b/vortex-btrblocks/benches/compress.rs index 6898b4a9ab4..b088c257489 100644 --- a/vortex-btrblocks/benches/compress.rs +++ b/vortex-btrblocks/benches/compress.rs @@ -3,6 +3,8 @@ #![expect(clippy::unwrap_used)] +use mimalloc::MiMalloc; + #[cfg(not(codspeed))] mod benchmarks { use std::sync::LazyLock; @@ -62,6 +64,9 @@ mod benchmarks { } } +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main() } diff --git a/vortex-btrblocks/benches/compress_listview.rs b/vortex-btrblocks/benches/compress_listview.rs index 502acf79e0f..881f0f0a0eb 100644 --- a/vortex-btrblocks/benches/compress_listview.rs +++ b/vortex-btrblocks/benches/compress_listview.rs @@ -4,6 +4,8 @@ #![expect(clippy::unwrap_used)] #![expect(clippy::cast_possible_truncation)] +use mimalloc::MiMalloc; + #[cfg(not(codspeed))] mod benchmarks { use std::sync::LazyLock; @@ -190,6 +192,9 @@ mod benchmarks { } } +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main() } diff --git a/vortex-buffer/Cargo.toml b/vortex-buffer/Cargo.toml index 02cf4ce7782..6cdd999aefc 100644 --- a/vortex-buffer/Cargo.toml +++ b/vortex-buffer/Cargo.toml @@ -39,6 +39,7 @@ workspace = true [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } num-traits = { workspace = true } rstest = { workspace = true } vortex-bench-support = { workspace = true } diff --git a/vortex-buffer/benches/allocation.rs b/vortex-buffer/benches/allocation.rs index 7f299ab91f1..7cdbcd22bc3 100644 --- a/vortex-buffer/benches/allocation.rs +++ b/vortex-buffer/benches/allocation.rs @@ -12,6 +12,7 @@ use allocator_api2::alloc::Global; use arrow_buffer::MutableBuffer; use bytes::BytesMut; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::Alignment; use vortex_buffer::Buffer; use vortex_buffer::BufferAllocatorRef; @@ -23,6 +24,9 @@ const SIZES: &[usize] = &[64, 256, 1024, 16_384, 65_536]; /// Allocate-and-drop pairs per timed iteration. const BATCH: usize = 256; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-buffer/benches/collect_bool.rs b/vortex-buffer/benches/collect_bool.rs index 083f608d6ba..5205c5ae415 100644 --- a/vortex-buffer/benches/collect_bool.rs +++ b/vortex-buffer/benches/collect_bool.rs @@ -28,12 +28,16 @@ //! A plain `cargo bench` ignores all of it and runs everything on the host. use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; #[cfg(not(codspeed))] use vortex_buffer::collect_bool_word_scalar; #[cfg(not(codspeed))] use vortex_buffer::pack_bool_word_swar; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { // Pre-warm CPUID feature detection so the one-time probe cost is never // included in any benchmark iteration. diff --git a/vortex-buffer/benches/cpu_dispatch.rs b/vortex-buffer/benches/cpu_dispatch.rs index 6891dd22119..6d15d51a5ef 100644 --- a/vortex-buffer/benches/cpu_dispatch.rs +++ b/vortex-buffer/benches/cpu_dispatch.rs @@ -20,8 +20,12 @@ use std::sync::LazyLock; use divan::Bencher; use divan::black_box; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_buffer::CpuKernel; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { // Resolve every dispatcher and warm the std feature-detection cache so no // benchmark iteration pays a one-time probe. diff --git a/vortex-buffer/benches/vortex_bitbuffer.rs b/vortex-buffer/benches/vortex_bitbuffer.rs index 6b7a2492a4d..fe5c1870792 100644 --- a/vortex-buffer/benches/vortex_bitbuffer.rs +++ b/vortex-buffer/benches/vortex_bitbuffer.rs @@ -6,9 +6,13 @@ use std::iter::Iterator; use arrow_buffer::BooleanBuffer; use arrow_buffer::BooleanBufferBuilder; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; use vortex_buffer::BitBufferMut; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { // Pre-warm CPUID feature detection so the one-time probe cost is never // included in any benchmark iteration. diff --git a/vortex-buffer/benches/vortex_buffer.rs b/vortex-buffer/benches/vortex_buffer.rs index 66afcd0dd64..3ba571751f6 100644 --- a/vortex-buffer/benches/vortex_buffer.rs +++ b/vortex-buffer/benches/vortex_buffer.rs @@ -7,12 +7,16 @@ use arrow_buffer::ArrowNativeType; use arrow_buffer::MutableBuffer; use arrow_buffer::ScalarBuffer; use divan::Bencher; +use mimalloc::MiMalloc; use num_traits::PrimInt; use vortex_buffer::Buffer; use vortex_buffer::BufferMut; use vortex_error::VortexExpect; use vortex_error::vortex_err; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-compressor/Cargo.toml b/vortex-compressor/Cargo.toml index 24a2d8e40d5..5977ac0227f 100644 --- a/vortex-compressor/Cargo.toml +++ b/vortex-compressor/Cargo.toml @@ -28,6 +28,7 @@ vortex-utils = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } vortex-array = { workspace = true, features = ["_test-harness"] } vortex-session = { workspace = true } diff --git a/vortex-compressor/benches/dict_encode.rs b/vortex-compressor/benches/dict_encode.rs index ec6343b6f40..c3e3a7b7251 100644 --- a/vortex-compressor/benches/dict_encode.rs +++ b/vortex-compressor/benches/dict_encode.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; use vortex_array::array_session; @@ -41,6 +42,9 @@ fn encode_generic(bencher: Bencher) { .bench_refs(|(array, ctx)| dict_encode(array, ctx).unwrap()); } +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main() diff --git a/vortex-compressor/benches/stats_calc.rs b/vortex-compressor/benches/stats_calc.rs index abbc34817f1..d8bf14b8685 100644 --- a/vortex-compressor/benches/stats_calc.rs +++ b/vortex-compressor/benches/stats_calc.rs @@ -1,6 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors +use mimalloc::MiMalloc; + #[cfg(not(codspeed))] #[divan::bench_group(items_count = 64_000u32, bytes_count = 256_000u32)] mod benchmarks { @@ -88,6 +90,9 @@ mod benchmarks { } } +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-compute/Cargo.toml b/vortex-compute/Cargo.toml index f8b710aacc5..07b489ede83 100644 --- a/vortex-compute/Cargo.toml +++ b/vortex-compute/Cargo.toml @@ -26,6 +26,7 @@ arrow-buffer = { workspace = true } arrow-cast = { workspace = true } arrow-schema = { workspace = true } divan = { workspace = true } +mimalloc = { workspace = true } num-traits = { workspace = true } rand = { workspace = true } vortex-bench-support = { workspace = true } diff --git a/vortex-compute/benches/lane_kernels.rs b/vortex-compute/benches/lane_kernels.rs index 0b1f704d020..1afa99de0d2 100644 --- a/vortex-compute/benches/lane_kernels.rs +++ b/vortex-compute/benches/lane_kernels.rs @@ -40,6 +40,7 @@ use arrow_cast::CastOptions; use arrow_cast::cast_with_options; use arrow_schema::DataType; use divan::Bencher; +use mimalloc::MiMalloc; use num_traits::AsPrimitive; use num_traits::NumCast; use rand::SeedableRng; @@ -53,6 +54,9 @@ use vortex_compute::lane_kernels::IndexedSourceExt; use vortex_compute::lane_kernels::LaneZip; use vortex_compute::lane_kernels::ReinterpretSink; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { assert_overflow_parity(); assert_null_overflow_suppressed(); diff --git a/vortex-file/Cargo.toml b/vortex-file/Cargo.toml index db947430ed8..5f5e92ae9d7 100644 --- a/vortex-file/Cargo.toml +++ b/vortex-file/Cargo.toml @@ -65,6 +65,7 @@ vortex-build = { workspace = true } [dev-dependencies] allocator-api2 = { workspace = true } divan = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } tokio = { workspace = true, features = ["full"] } vortex-array = { workspace = true, features = ["_test-harness"] } diff --git a/vortex-file/benches/split_collection.rs b/vortex-file/benches/split_collection.rs index 2c4ccd0053e..36c8e6b9391 100644 --- a/vortex-file/benches/split_collection.rs +++ b/vortex-file/benches/split_collection.rs @@ -16,6 +16,7 @@ use std::sync::Arc; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use vortex_array::IntoArray; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::StructArray; @@ -37,6 +38,9 @@ use vortex_layout::session::LayoutSession; use vortex_session::VortexSession; use vortex_utils::aliases::hash_map::HashMap; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-layout/Cargo.toml b/vortex-layout/Cargo.toml index c7192cbb61e..99b333312a6 100644 --- a/vortex-layout/Cargo.toml +++ b/vortex-layout/Cargo.toml @@ -64,6 +64,7 @@ divan = { workspace = true } futures = { workspace = true, features = ["executor"] } goldenfile = { workspace = true } insta = { workspace = true } +mimalloc = { workspace = true } rand = { workspace = true } rstest = { workspace = true } temp-env = { workspace = true } diff --git a/vortex-layout/benches/aggregate_partial_merge.rs b/vortex-layout/benches/aggregate_partial_merge.rs index 05f9ab6aa58..d3a9eec2b34 100644 --- a/vortex-layout/benches/aggregate_partial_merge.rs +++ b/vortex-layout/benches/aggregate_partial_merge.rs @@ -20,6 +20,7 @@ use std::sync::LazyLock; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use vortex_array::ArrayRef; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; @@ -39,6 +40,9 @@ use vortex_layout::layouts::zoned::aggregates::bloom_filter::BloomOptions; use vortex_layout::layouts::zoned::aggregates::bloom_filter::HashFn; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main(); diff --git a/vortex-layout/benches/bloom_filter.rs b/vortex-layout/benches/bloom_filter.rs index f7d7815a5ab..f6d4d89ec42 100644 --- a/vortex-layout/benches/bloom_filter.rs +++ b/vortex-layout/benches/bloom_filter.rs @@ -12,6 +12,7 @@ use std::num::NonZeroU32; use divan::Bencher; use divan::counter::ItemsCount; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -19,6 +20,9 @@ use vortex_layout::layouts::zoned::aggregates::bloom_filter::BloomOptions; use vortex_layout::layouts::zoned::aggregates::bloom_filter::BloomPartial; use vortex_layout::layouts::zoned::aggregates::bloom_filter::HashFn; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-layout/benches/zone_map_prune.rs b/vortex-layout/benches/zone_map_prune.rs index 9ea491f9647..2cf0a4f7ba8 100644 --- a/vortex-layout/benches/zone_map_prune.rs +++ b/vortex-layout/benches/zone_map_prune.rs @@ -12,6 +12,7 @@ use std::sync::Arc; use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use parking_lot::Mutex; use vortex_array::ArrayRef; use vortex_array::IntoArray; @@ -43,6 +44,9 @@ use vortex_layout::session::LayoutSession; use vortex_session::VortexSession; use vortex_utils::aliases::hash_map::HashMap; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-mask/Cargo.toml b/vortex-mask/Cargo.toml index cf681101d43..153613f9f7f 100644 --- a/vortex-mask/Cargo.toml +++ b/vortex-mask/Cargo.toml @@ -27,6 +27,7 @@ vortex-error = { workspace = true } [dev-dependencies] divan = { workspace = true } +mimalloc = { workspace = true } rstest = { workspace = true } [[bench]] diff --git a/vortex-mask/benches/intersect_by_rank.rs b/vortex-mask/benches/intersect_by_rank.rs index bd6c5f18c5b..f6d94797195 100644 --- a/vortex-mask/benches/intersect_by_rank.rs +++ b/vortex-mask/benches/intersect_by_rank.rs @@ -4,9 +4,13 @@ //! Benchmarks for `intersect_by_rank`. use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; use vortex_mask::Mask; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-mask/benches/mask_iteration.rs b/vortex-mask/benches/mask_iteration.rs index 84ca37991ef..3e384e14e36 100644 --- a/vortex-mask/benches/mask_iteration.rs +++ b/vortex-mask/benches/mask_iteration.rs @@ -19,8 +19,12 @@ #![allow(clippy::unwrap_used, clippy::cast_possible_truncation)] use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex-mask/benches/rank.rs b/vortex-mask/benches/rank.rs index fa2b820f75d..d5d3da74ffd 100644 --- a/vortex-mask/benches/rank.rs +++ b/vortex-mask/benches/rank.rs @@ -6,9 +6,13 @@ #![allow(clippy::unwrap_used, clippy::cast_possible_truncation)] use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; use vortex_mask::Mask; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { // Pre-resolve the one-time CpuKernel selections on the rank/select path so no // benchmark iteration pays the first-call cost. diff --git a/vortex-mask/benches/valid_counts.rs b/vortex-mask/benches/valid_counts.rs index 425a021fa6f..d74a5b79deb 100644 --- a/vortex-mask/benches/valid_counts.rs +++ b/vortex-mask/benches/valid_counts.rs @@ -12,9 +12,13 @@ #![allow(clippy::unwrap_used, clippy::cast_possible_truncation)] use divan::Bencher; +use mimalloc::MiMalloc; use vortex_buffer::BitBuffer; use vortex_mask::Mask; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex/benches/pipeline.rs b/vortex/benches/pipeline.rs index 5fa3f646c50..a53dba2e430 100644 --- a/vortex/benches/pipeline.rs +++ b/vortex/benches/pipeline.rs @@ -112,6 +112,7 @@ use divan::Bencher; use fastlanes::BitPacking; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -158,6 +159,9 @@ const SAMPLE_SIZE: u32 = 4096; // Main //////////////////////////////////////////////////////////////////////////////////////////////////// +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { divan::main(); } diff --git a/vortex/benches/take_union.rs b/vortex/benches/take_union.rs index a7072254275..ff0f1e2a25a 100644 --- a/vortex/benches/take_union.rs +++ b/vortex/benches/take_union.rs @@ -26,6 +26,7 @@ use std::sync::LazyLock; use divan::Bencher; +use mimalloc::MiMalloc; use rand::RngExt; use rand::SeedableRng; use rand::rngs::StdRng; @@ -45,6 +46,9 @@ use vortex::buffer::Buffer; use vortex::encodings::sparse::Sparse; use vortex_session::VortexSession; +#[global_allocator] +static GLOBAL: MiMalloc = MiMalloc; + fn main() { LazyLock::force(&SESSION); divan::main();