perf: mimalloc as the global allocator (+5% fps, smoother spawn under Proton) #35

Closed
github-bot wants to merge 1 commit from github-bot/gh-35 into main AGit
Owner

@⁠Timmybread22 on GitHub · 2026-12-01 06:49 UTC · original
Timmybread22:pr-mimalloc → main · +24 −4 · 3 files · 1 commits · closed without merging

Swaps the system allocator under copystat::Counting for mimalloc (the counting stays as it is).

Why: a profile of victory-submit under Proton showed ~18% of its samples in Counting::realloc/alloc, which is Wine's HeapAlloc/HeapReAlloc. With mimalloc they are gone from the profile.

Measured (CachyOS, RX 6900 XT on RADV / Mesa 26.3, Ryzen 9 5900X, patched Proton, same save, 2-minute runs):

  • median rendered fps 15.2 / 15.2 vs 14.2–14.9 before
  • first 15 s after spawning: ~12 fps vs ~9.5

Builds with cargo xwin as is (mimalloc = { version = "0.1", default-features = false }). Not tested on Windows.

🤖 Generated with Claude Code

**@⁠Timmybread22** on GitHub · 2026-12-01 06:49 UTC · [original](https://github.com/Slaktarn700/SlaktarnVI/pull/35) `Timmybread22:pr-mimalloc` → `main` · +24 −4 · 3 files · 1 commits · closed without merging Swaps the system allocator under `copystat::Counting` for mimalloc (the counting stays as it is). **Why:** a profile of `victory-submit` under Proton showed ~18% of its samples in `Counting::realloc`/`alloc`, which is Wine's `HeapAlloc`/`HeapReAlloc`. With mimalloc they are gone from the profile. **Measured** (CachyOS, RX 6900 XT on RADV / Mesa 26.3, Ryzen 9 5900X, patched Proton, same save, 2-minute runs): - median rendered fps 15.2 / 15.2 vs 14.2–14.9 before - first 15 s after spawning: ~12 fps vs ~9.5 Builds with `cargo xwin` as is (`mimalloc = { version = "0.1", default-features = false }`). Not tested on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Under Wine the system heap (HeapAlloc/HeapReAlloc) was ~18% of the
victory-submit thread's samples (copystat::Counting realloc+alloc).
With mimalloc it is gone from the profile.

Measured on CachyOS, RX 6900 XT (RADV, Mesa 26.3), Ryzen 9 5900X,
patched Proton, same save, 2-minute runs: median 15.2/15.2 vs
14.2-14.9 rendered fps; first 15 s after spawning ~12 vs ~9.5 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AoQ5bRM1mEZCeS7Gs5bN7n
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 06:50:10 +00:00
github-bot force-pushed github-bot/gh-35 from fe0c977b4f to ee73d9b862 2026-12-01 06:55:28 +00:00 Compare
Author
Owner

@⁠Slaktarn700 on GitHub · 2026-12-01 14:56 UTC · original

I tried mimalloc 0.1.52 before on this PC: faster per call (7-12 ns against 31-45), but the frame was the same (57.7 ms in both, one run each). Your 5900X may gain where mine does not: please run it as pairs on one scene, equal draws, two or three each, and I will look again. A new dependency is not taken for a gain I cannot see.

**@⁠Slaktarn700** on GitHub · 2026-12-01 14:56 UTC · [original](https://github.com/Slaktarn700/SlaktarnVI/pull/35#issuecomment-7315076281) I tried mimalloc 0.1.52 before on this PC: faster per call (7-12 ns against 31-45), but the frame was the same (57.7 ms in both, one run each). Your 5900X may gain where mine does not: please run it as pairs on one scene, equal draws, two or three each, and I will look again. A new dependency is not taken for a gain I cannot see.
Author
Owner

@⁠Slaktarn700 on GitHub · 2026-12-05 03:25 UTC · original

Thank you. Since 2026-12-02 main is on a new base (VIctory-xmem), and the files this changes are not there anymore, so it cannot merge as it is. If the same idea helps on the new base, a new pull request against main is welcome.

**@⁠Slaktarn700** on GitHub · 2026-12-05 03:25 UTC · [original](https://github.com/Slaktarn700/SlaktarnVI/pull/35#issuecomment-7431044737) Thank you. Since 2026-12-02 main is on a new base (VIctory-xmem), and the files this changes are not there anymore, so it cannot merge as it is. If the same idea helps on the new base, a new pull request against main is welcome.
github-bot closed this pull request 2026-12-05 05:02:41 +00:00
Author
Owner

@⁠Slaktarn700 on GitHub · 2026-12-05 05:00 UTC · original

Thank you. The new base (VIctory-xmem, on main since 2026-12-02) already does this: every allocation goes through mimalloc there (PortHeap in crates/victory-gpu/src/port_heap.rs). So there is nothing left to merge, and the files this changes look different now. Closing as done.

**@⁠Slaktarn700** on GitHub · 2026-12-05 05:00 UTC · [original](https://github.com/Slaktarn700/SlaktarnVI/pull/35#issuecomment-7432305724) Thank you. The new base (VIctory-xmem, on main since 2026-12-02) already does this: every allocation goes through mimalloc there (`PortHeap` in `crates/victory-gpu/src/port_heap.rs`). So there is nothing left to merge, and the files this changes look different now. Closing as done.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.