Skip to content

Commit 86c3f39

Browse files
tamirhemoclaude
andcommitted
perf(bench): add optional mimalloc allocator for sp1-perf (-7.2% fib)
Add mimalloc as an optional feature for sp1-perf. When enabled, replaces glibc malloc with mimalloc's per-thread arenas, reducing lock contention in allocation-heavy paths. Benchmark results (on top of physical-cores change): fib: 28,551ms → 26,504ms (-7.2%) keccak: 35,648ms → 34,845ms (-2.3%) big: 38,228ms → 37,899ms (-0.9%) Usage: cargo build --release -p sp1-perf --features mimalloc Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b2a6833 commit 86c3f39

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

Cargo.lock

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

crates/perf/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tracing = { workspace = true }
3333
serde = { workspace = true }
3434
serde_json = { workspace = true }
3535
test-artifacts = { path = "../test-artifacts" }
36+
mimalloc = { version = "0.1", optional = true }
3637

3738
[[bin]]
3839
name = "sp1-perf"

crates/perf/src/perf.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#[cfg(feature = "mimalloc")]
2+
#[global_allocator]
3+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
4+
15
use std::{
26
future::Future,
37
time::{Duration, Instant},

0 commit comments

Comments
 (0)