Skip to content

24 GB Mac: 5.5 fps in the prison cell, gains per revision (main-mac + upstream perf PRs) #577

Backlog

Description

@ottco-dev

@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:

What did not help (measured):

  • A plain memcpy instead of ReadProcessMemory for 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

  1. pragyaangaur commented on Nov 28, 2026

    @pragyaangaur
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions