Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions docs/developer-guide/benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,23 @@ 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;
#[global_allocator]
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.
Expand Down
1 change: 1 addition & 0 deletions encodings/alp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 4 additions & 0 deletions encodings/alp/benches/alp_compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions encodings/datetime-parts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 4 additions & 0 deletions encodings/datetime-parts/benches/split_temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions encodings/decimal-byte-parts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 4 additions & 0 deletions encodings/decimal-byte-parts/benches/dbp_assemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/decimal-byte-parts/benches/dbp_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions encodings/fastlanes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/bitpack_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/bitpack_compare_sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/bitpacking_take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use std::sync::LazyLock;

use divan::Bencher;
use mimalloc::MiMalloc;
use rand::RngExt;
use rand::SeedableRng;
use rand::distr::Uniform;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/canonicalize_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/cast_bitpacked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::sync::LazyLock;

use divan::Bencher;
use mimalloc::MiMalloc;
use rand::RngExt;
use rand::SeedableRng;
use rand::prelude::StdRng;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/compute_between.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use std::sync::LazyLock;

use mimalloc::MiMalloc;
use num_traits::NumCast;
use rand::RngExt;
use rand::rngs::StdRng;
Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions encodings/fsst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions encodings/fsst/benches/chunked_dict_fsst_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
Loading
Loading