Skip to content

A benchmark on the Mac: scripts/bench.py with fixed routes and frame-time percentiles - #191

Closed
v0lumehi wants to merge 2 commits into
seedds:mainfrom
v0lumehi:bench-script
Closed

v0lumehi wants to merge 2 commits into
seedds:mainfrom
v0lumehi:bench-script

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

A repeatable benchmark for a game on the Mac host, as asked for in #159: the same save, the same scripted route, the same measuring window, and frame-time percentiles instead of a single fps figure. The baseline in #159 (comment) was measured with it.

What it does

python3 scripts/bench.py <NSP folder>/<id>_build [--route zora-pan] [--fps 120] [--variant 'label:KEY=VALUE,…'] [--runs 2]

  • Inputs: a game prepared with --platform mac. Each run starts from a copy of the same save (--save, default <id>_build/run/save, never written).
  • Route: a line of the profile's new bench.tsv, with the scripted input (DM_KEYS, seconds from start) and the measured window. Breath of the Wild gets three routes: Zora's Domain with the camera turning and Link walking, the same standing still, and a probe for the load time.
  • Numbers: taken from the host's per-frame rows (DM_NVN_TSV, timing only):
    • frame time (start to start) and time on screen, p50 / p95 / p99 / max;
    • frames longer than 1.5 frame times, and dropped frames;
    • GPU time p50 / p95;
    • the game's speed against real time where the frame step logs it, and the [RED] lines.
  • Variants: environment switches, or another host binary, shader libraries, shader map, rewritten modules or pipeline archive. They run in turn and repeated. Results are medians with their range in results.md / results.json, beside each run's log, frames.tsv and two screenshots taken at the same moments.

Files

  • scripts/bench.py: the script, which runs from a terminal.
  • dm/games/01007EF00011E000/bench.tsv: BotW's routes.
  • docs/development.md: a new section, "A benchmark on the Mac".
  • dm/games/README.md: bench.tsv in the profile file list.
  • dm/tools/tests/test_bench.py: checks the window, the percentiles (nearest rank) and that every bench.tsv parses.

Tested

Not done

…platform mac along a fixed route and reports frame-time percentiles

A route is a line of the profile's new bench.tsv: the scripted input (DM_KEYS, seconds from the start) and the measured window, from when the scene is loaded. Each run starts from a copy of the same save and reads the host's per-frame rows (DM_NVN_TSV): frame time (start to start) and time on screen at p50 / p95 / p99 / max, frames longer than 1.5 frame times, dropped frames, GPU time p50 / p95, the game's speed against real time where the frame step logs it, and the [RED] lines. Variants (environment switches, or another host, shader libraries, rewritten modules or pipeline archive) run in turn, repeated, and are reported as medians with their range in results.md / results.json beside each run's log, frames.tsv and two screenshots at the same moments. Breath of the Wild has three routes: a save in Zora's Domain with the camera turning and Link walking (zora-pan), the same standing still, and a probe for the load time.

Used for the baseline in issue seedds#159: main + seedds#76 + seedds#158 on an M2 Max at 900p and a 120 fps target, three variants, two runs each. docs/development.md ("A benchmark on the Mac") and dm/games/README.md describe it; dm/tools/tests/test_bench.py checks the window, the percentiles (nearest rank) and that every bench.tsv parses.
… variable frame step); at 60 or 30 the host matches the screen to the cap itself, and the forced 120 Hz link ran Breath of the Wild at 2.4 times real time at --fps 60
seedds added a commit that referenced this pull request Oct 26, 2026
Run profile-defined routes from independent copies of one save and report frame-time, presentation and GPU percentiles across repeated variants. Preserve the display-link behavior for targets at or below 60 fps.

Resolve relative paths before launching in the run folder, preserve the archive-disable sentinel, aggregate optional metrics from the runs that supplied them, and release the measurement lock when launch fails. Regression tests exercise an actual synthetic child host and leave the source save intact.

Validated with benchmark regressions, the CI-style Python test suite, and documentation checks. The three new benchmark regression cases reject the original PR code.

Co-authored-by: v0lumehi <aljic.zijad@gmail.com>
@seedds

seedds commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Landed on main as 3f22526, before the GPU diagnostics from #225, with Co-authored-by: v0lumehi <aljic.zijad@gmail.com>.

The benchmark and profile routes are included. Review fixes resolve output and variant paths before changing the child working directory, preserve pso=off, aggregate optional metrics from the runs that supplied them, and release the measurement lock if the host cannot launch. The three benchmark regression cases reject the original PR implementation and pass with the fixes; the synthetic child-host test also checks that the source save stays unchanged.

Validation: all 31 CI-style Python test files passed on the reviewed tree; the focused benchmark, profiling, documentation and iOS workflow checks passed again after rebasing onto latest main. No new gameplay validation. Closing because the implementation and fixes have landed directly on main.

@seedds seedds closed this Oct 26, 2026
@v0lumehi
v0lumehi deleted the bench-script branch October 26, 2026 09:29
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
Run profile-defined routes from independent copies of one save and report frame-time, presentation and GPU percentiles across repeated variants. Preserve the display-link behavior for targets at or below 60 fps.

Resolve relative paths before launching in the run folder, preserve the archive-disable sentinel, aggregate optional metrics from the runs that supplied them, and release the measurement lock when launch fails. Regression tests exercise an actual synthetic child host and leave the source save intact.

Validated with benchmark regressions, the CI-style Python test suite, and documentation checks. The three new benchmark regression cases reject the original PR code.

Co-authored-by: v0lumehi <aljic.zijad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants