Repository navigation
Description
@GDemay thanks for #533, #535, #551 and #571–#576: here is what they and the rest of the stack do in the game on a 24 GB Mac.
Follow-up to #505: the same 24 GB Mac now runs the prison cell at 183 ms a frame (5.5 fps), many frames in the 170s. Below, what each step of the stack gained, measured the same way on the same save.
Mac: Mac mini (Mac17,16), M5 Pro, 24 GB, macOS 27.2.1, CrossOver 26.3 Wine from tools/macos, D3DMetal 4.0 beta 3, Series X (1.0.2.1). Build: halfwave50's main-mac (cbf96d2) with commits on top, release build, warm shader cache and pipeline library (0 shaders translated live in every row).
Settings (the same in every row): everything play-main-mac.sh sets, plus VICTORY_OUTPUT=1920x1080 VICTORY_RENDER_SCALE=0.5 VICTORY_CENSUS_BATCH=1 VICTORY_GPU_BUDGET_MB=4500 VICTORY_RAM_LOW=0.12 VICTORY_RAM_FREE=0.16 VICTORY_ALIAS_BUFFERS=0 VICTORY_SMALL_LOOSE_WINDOWS=1 VICTORY_EVICT_HEAP_UAV=1 VICTORY_SPILL_SHADERS=1 VICTORY_STEP_OVER=pool VICTORY_NO_HANG_WATCHDOG=1.
Method: the save loads into the opening and then the prison cell by itself; the camera never moves. Frame-rate lines with at least 3,000 draws, the first 6 skipped, medians of the next 30. One run per row.
| Stack (cumulative) | frame | fps | preparing | GPU | copying back | draws | ms per 1,000 draws |
|---|---|---|---|---|---|---|---|
| Before the settings above (reported in #505) | 242 ms | 4.1 | 127 | 74 | — | ~4,750 | — |
main-mac + #381 #456 #415 #416 #436 #452 + Shadow::idle fix + #499 #495 + #530 ¹ |
206 ms | 4.86 | 109 | 60 | 28 | 4,324 | 47.4 |
| + clock read per copy, not per range (as #470/#549 do on main) + one periodic timer for the held-work tick | 189 ms | 5.29 | 88 | 61 | 30 | 4,412 | 42.9 |
+ address hasher for Batch's maps + #535 + #533 (ported) |
194 ms | 5.16 | 92 | 63 | 30 | 4,776 | 40.3 |
| + #551 #571 #572 #573 #575 #576 | 183 ms | 5.47 | 82 | 61 | 30 | 4,378 | 41.8 |
¹ This run also had VICTORY_AMBIENT_PROBE=4 on, which leaves out passes of the ambient estimate in turn; that pass costs ~3 ms here, so the row is at most a few ms optimistic.
Reading it:
- The draw count is not constant from build to build, although save and camera are: the third row drew ~10 % more in the same scene, which is why it is slower per frame but faster per draw. ms per 1,000 draws is the fairer column; it fell from 47.4 to ~41–42.
- The largest single step was the clock: on halfwave50's line
flush_workreadInstant::nowtwice per refresh range (~23,000 a frame) andrun_deferredonce per step, each a kernel call under Wine. Main already has this fixed (perf(gpu): read the clock for copy steps only in run_deferred #470, perf(gpu): one guard-lock acquisition per shadow instead of per range #549). - The held-work timer applies to main:
queue.rsstill doesstd::thread::sleep(2 ms)in a loop, andsleepmakes and closes a waitable timer per call (two wineserver round trips, ~500 a second). Here it waits on one periodic timer instead. - GDemay's perf(formats): skip equal blocks inside texture refreshes #551 and perf(formats): copy contiguous linear texture rows in one span #571–perf(xma): gather frame payloads in spans between packet boundaries #576 are CPU-side (texture refresh, linear rows, XMA); together with run-to-run noise they show as 194 → 183 ms here. Not an A/B per PR.
- Not used: perf(gpu): one guard-lock acquisition per shadow instead of per range #549, because of Batched shadow refresh can miss a write to a later range #558 (a write to a later range can be missed in the current submission).
What did not help (measured):
- A plain
memcpyinstead ofReadProcessMemoryfor the copy-back (behind a switch): no change, copying back stayed at 30 ms. The cost is the bytes, not the kernel call. - A finer copy-back grain: measured on the pages that go back, a 4 KiB grain would write ~81 % of the bytes and a 256 B grain ~72 %, so at most a few ms. The shaders change these pages densely.
VICTORY_SHADER_OPT=64: needs its own warm-up (new cache key); without one the run translated 2,249 shaders live.
Where the time still goes (profile of the cell, VICTORY_PROFILE, before the last three rows): the submitting thread is the critical path (~90 ms a frame alone); on it NtReadVirtualMemory (refresh and copy-back copies) and NtProtectVirtualMemory (guards) are the largest items, and the GPU takes ~61 ms.
The first part of the stack is halfwave50/VIctory-macOS-halfwave50#2; I'm happy to open the held-work timer as a PR against main.
AI use: Claude Code (Claude Opus 5.5) built the stack, wrote the two mac: changes and the benchmark script, ran the runs and the profile, and wrote this issue. The game started by itself from the save; nobody played.
Activity
pragyaangaur commentedon Nov 28, 2026
Thank you for this table. Going from 4.1 to 5.5 fps with each step measured on the same save is exactly the evidence we need to pick what to default next. Many of the PRs in the stack (#587, #588, #598, #599, #611 and #653) merged into main today, so a rerun of the same save on current main would show what is left. If a row was neutral or negative, please say so, and we will keep that change opt-in.
docs: bring the README's tester status and the gallery up to 28 November