chore: use mimalloc for codspeed benchmark allocator#204
Conversation
Route NeverGrowInPlaceAllocator alloc/dealloc through mimalloc::MiMalloc on non-wasm targets so CodSpeed can white-box allocator activity. Keep the wrapper without a realloc override to preserve never-grow-in-place benchmark behavior. Wasm stays on System. Ported from web-infra-dev/rspack#13966.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92406e97fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR ports rspack’s CodSpeed benchmark allocator setup into rspack-resolver by routing benchmark allocations through mimalloc (on non-wasm targets) while preserving the “never grow in place” realloc behavior to stabilize benchmark results.
Changes:
- Add target-specific
mimallocdev-dependencies (with feature flags aligned to rspack’s benchmark harness). - Update the benchmark global allocator to wrap
mimalloc::MiMallocon non-wasm andSystemon wasm, while intentionally not overridingrealloc. - Regenerate
Cargo.lockto includemimallocand related transitive updates.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Cargo.toml | Adds target-specific mimalloc dev-dependencies for benchmarks. |
| Cargo.lock | Locks mimalloc + transitive dependencies and updates windows-sys entries accordingly. |
| benches/resolver.rs | Switches benchmark global allocator to a wrapper around mimalloc (non-wasm) / System (wasm) without realloc override. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merging this PR will degrade performance by 94.31%
Performance Changes
Comparing |
Summary
Port of web-infra-dev/rspack#13966 to this repo's benchmark harness.
NeverGrowInPlaceAllocatoralloc/deallocthroughmimalloc::MiMallocon non-wasm targets so CodSpeed can white-box allocator activity.reallocoverride to preserve never-grow-in-place benchmark behavior —reallocfalls through to the defaultGlobalAlloc::realloc(alloc-new + copy + dealloc-old), which is what stabilizes results.Systemand alignmimallocfeature flags (local_dynamic_tlson Linux,v3everywhere) withrspack_allocator.Verification