Skip to content

Commit e6056cf

Browse files
chore(bench): use mimalloc as global allocator in bench crate (#8844)
The bench crate was using the system allocator instead of mimalloc, making benchmark results unrepresentative of production performance. Adds `mimalloc-safe` as a dependency and sets `#[global_allocator]` so benchmarks match the actual NAPI bindings allocator configuration.
1 parent c35b547 commit e6056cf

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bench/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ codspeed = ["criterion2/codspeed"]
3232

3333
[dev-dependencies]
3434
rustc-hash = { workspace = true }
35+
mimalloc-safe = { workspace = true }

crates/bench/benches/bench.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[global_allocator]
2+
static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
3+
14
use bench::{BenchMode, DeriveOptions, bench_preset, rome_ts_preset, run_bench_group};
25
use criterion::{Criterion, criterion_group, criterion_main};
36
use rolldown::{BundlerOptions, ModuleType};

0 commit comments

Comments
 (0)