Rust allocations through mimalloc (+2 fps on an RTX 4090) #11
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!11
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Dastano on GitHub · 2026-11-26 20:54 UTC · original
Dastano:perf/mimalloc→main· +47 −4 · 7 files · 2 commits · closed without mergingRust-side allocations go through mimalloc instead of the Windows process heap. On by default for the
victoryapp (featuremimalloc);--no-default-featuresgives the old behaviour.Why
A sampling profile (
VICTORY_PROFILE, symbolized against the diag PDB) of the jail scene shows the thread that submits (victory-submit, the frame's critical path) spending about 15 % of its samples in the process heap (ntdllunderrealloc/alloc): vectors that grow on every submission inHost::submit,shadow::word_runs_avx2,Shadow::merge_under_writes,watch::writes,card_steps::does_of. That heap is shared with the title and the drivers. mimalloc keeps per-thread caches and grows blocks in place more often.What changes
crates/victory-gpu: optional dependencymimalloc, featuremimalloc. Release builds with it setmimalloc::MiMallocas the global allocator; diagnostics builds keepcopystat's counting allocator, which then forwards to mimalloc instead ofSystem(the counters stay as they are).crates/victory-hle,apps/victory: the feature passed through;apps/victoryhas it on by default.Measured
RTX 4090 24 GB (driver 621.14), Ryzen 9 7950X3D, 32 GB, Windows 11, title 1.0.2.1.
scripts/play-nvidia.ps1defaults (Series S, half render scale), diag build, warm pipeline cache, the same unattended route each run (Enter through the start screens, 420 s); figures are the jail scene, last 2 minutes of 5-s fps lines:About +2 fps (+9 %), preparing about 3 ms shorter a frame. Screenshots of the same moments show no change in the picture. Built and checked:
cargo build --locked --profile diag -p victory --features diagnostics,cargo build --locked --release -p victory,cargo test -p victory-gpu --features "diagnostics mimalloc" --lib copystat.The build now compiles mimalloc's C sources (through
cc, with the MSVC tools the build already needs).🤖 Generated with Claude Code
mimalloc) c6efc449bePull request closed