Skip to content

perf(bench): add optional mimalloc allocator for sp1-perf (-7.2% fib)#2728

Open
tamirhemo wants to merge 1 commit into
tamir/perf-physical-coresfrom
tamir/perf-mimalloc
Open

perf(bench): add optional mimalloc allocator for sp1-perf (-7.2% fib)#2728
tamirhemo wants to merge 1 commit into
tamir/perf-physical-coresfrom
tamir/perf-mimalloc

Conversation

@tamirhemo
Copy link
Copy Markdown
Contributor

Summary

  • Add mimalloc as optional feature for sp1-perf
  • Replaces glibc malloc with mimalloc's per-thread arenas, reducing lock contention

Benchmark results (on top of physical-cores change)

Workload glibc mimalloc Delta
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

Stack

  1. feat(bench): add CPU prover benchmark harness and baseline profiling #2726 — bench infra + baselines
  2. perf(prover): default rayon to available_parallelism #2727 — E1: rayon defaults to physical cores (-19.8% big)
  3. This PR — E2: optional mimalloc allocator

Test plan

  • cargo build -p sp1-perf works without mimalloc (no behavior change)
  • cargo build -p sp1-perf --features mimalloc compiles and runs
  • Bench results show improvement on fib workload

🤖 Generated with Claude Code

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>
@tamirhemo tamirhemo force-pushed the tamir/perf-physical-cores branch from b2a6833 to 31ac2a3 Compare April 21, 2026 16:34
@tamirhemo tamirhemo force-pushed the tamir/perf-mimalloc branch from 86c3f39 to 07c5d15 Compare April 21, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant