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

Open
Timmybread22 wants to merge 1 commit from upstream-pr/35 into main
Timmybread22 commented 2026-12-01 06:49:55 +00:00 (Migrated from github.com)

Imported from Slaktarn700/SlaktarnVI. Originally posted by Timmybread22 on 2026-12-01T06:49:55Z.


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

<!-- greyfinch-sync:Slaktarn700/SlaktarnVI:issue:5580627959 --> Imported from [Slaktarn700/SlaktarnVI](https://github.com/Slaktarn700/SlaktarnVI/pull/35). Originally posted by [Timmybread22](https://github.com/Timmybread22) on 2026-12-01T06:49:55Z. --- 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)
Slaktarn700 commented 2026-12-01 14:56:27 +00:00 (Migrated from github.com)

Imported from Slaktarn700/SlaktarnVI. Originally posted by Slaktarn700 on 2026-12-01T14:56:27Z.


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.

<!-- greyfinch-sync:Slaktarn700/SlaktarnVI:comment:7315076281 --> Imported from [Slaktarn700/SlaktarnVI](https://github.com/Slaktarn700/SlaktarnVI/pull/35#issuecomment-7315076281). Originally posted by [Slaktarn700](https://github.com/Slaktarn700) on 2026-12-01T14:56:27Z. --- 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.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/35:upstream-pr/35'
git switch 'upstream-pr/35'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/35'
git switch 'upstream-pr/35'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/35'
git switch 'upstream-pr/35'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/35'
git switch 'main'
git merge --squash 'upstream-pr/35'
git switch 'main'
git merge --ff-only 'upstream-pr/35'
git switch 'main'
git merge 'upstream-pr/35'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Slaktarn700/SlaktarnVI!35
No description provided.