Log inGet started
World

Frame Lab: Repeatable Performance Benchmarks and Game Charts

Branchmain
Branchesmain
Commite1ade4ce7c

README.md

benchmark-a-change

Answers "did my change make the world faster or slower?" with benchKit, as a run the engine holds stage by stage. Use it to compare performance between two builds, benchmark a change, measure before and after performance, or run a performance regression check.

What it does

  1. Conditions. Checks the benchmark exists and records the device, build type, window size, quality level and render scale. Nothing of these may change until the run ends: benchKit refuses to compare reports taken under different conditions.
  2. Baseline. Runs the benchmark twice (zero benchKit run <benchmark> --label "...") and compares the two. Two runs of the same thing must read no change and both be settled. If not, it tries up to two more pairs, then stops with outcome = "machine too noisy" and what to look at (other programs, the frame cap, thermal throttling).
  3. Change. With args.change, an agent makes that change in the world's files. Without it, the run asks the person or agent to make the change and confirm it is in place.
  4. After. Runs the same benchmark again, labelled with the change.
  5. Compare. zero benchKit compare <baseline> <after>. A refusal ends the run with outcome = "refused: conditions differ" and the differences it named.
  6. Verdict. Summarises the numbers that moved beyond noise in this order: 95th percentile frame and 1% low, engine CPU and GPU, draw calls / triangles / pixels shaded / shadow pages, memory; then faster, slower, mixed or no change. With args.promote, a faster or unchanged after-run is promoted to the reference shelf for that device.

The run returns { outcome, summary, promoted, change, conditions, baseline, after, compare }, where baseline and after are { id, settled, headline, warnings } and compare is { summary, changed, refused, differences }.

Args

Arg
benchmarkThe benchmark (a Bench.define name or a module returning a definition). Default benchKit.sample.
changeThe change under test, in plain words, for an agent to make. Optional.
labelShort name for the change used in report labels. Defaults to change.
promoteDevice name to promote the after-run under, when it is not slower. Optional.

Running it

From the engine shell:

zero workflow start --name benchKit.benchmark-a-change --args '{"benchmark":"benchKit.sample","change":"halve the prop count"}'
zero workflow status
zero workflow next --runner <who you are>
zero workflow answer --request <id> --value '<json>'

From Luau:

asset.resolve("benchKit.benchmark-a-change", "workflow"):start({ benchmark = "benchKit.sample", change = "..." })

It needs benchKit (this package) and a quiet machine. Each benchmark run takes about 1 to 3 minutes; a full run is five of them. The step-by-step guide workflow-benchmark-a-change-step-by-step describes the same procedure for people doing it by hand.