T-050: Performance tracking: benchmark worlds, history and alarm
Goal
Make speed something the project always knows. Every merge is measured against the same set of benchmark worlds, the history is kept and charted, and a slowdown raises an alarm.
Evan, 2026-12-02: very large worlds and very long runs are a permanent goal. See "Speed is
a feature" in docs/DESIGN.md section 12 and "Performance never finishes" in
docs/RUNBOOK.md.
Scope
- Standard benchmark worlds. A small suite that covers what the sim does today. Each
world is defined by a file, so adding one is adding a file. Start from what
runner benchalready has (T-001). Later feature tickets add their own workload here. - One command,
scripts/perf.sh, runs the suite at fixed thread counts (1, 4 and all cores) and appends rows todocs/perf/history.csv: commit, date, machine, world, cells, threads, steps per second, time in each phase of the step, peak memory, bytes per cell. - Per-phase timing in the step pipeline, cheap enough to leave on, so every number says where the time went.
- Noise. Repeat each measurement, and record the median and the spread. State how large a change has to be before it is real on this machine while other agents are using it.
- Alarm.
scripts/perf.sh --checkcompares against recent runs onmain, prints a table, and exits non-zero when a world is slower by more than the noise allows. The threshold is a setting. - Chart of the history on the project pages (
scripts/build-log.py,/log/), readable on a phone. - How to profile here.
docs/perf/README.md: how to get a profile of the headless runner on this machine with no display, tried and working, with one example reading. - Ideas file.
docs/perf/IDEAS.md: one line per idea, with where it came from and a guess at the gain. Seed it from the Result sections of finished tickets.
Done when
- ☐
scripts/perf.shandscripts/perf.sh --checkwork from a clean checkout and are documented indocs/perf/README.md. - ☐ A deliberately slowed build trips the alarm. A rebuild of the same commit does not.
- ☐ The history has rows for the current
main, and the chart is on the project pages. - ☐ Adding a benchmark world is one file, and the README says how.
Notes
- Keep the suite short enough to run on every merge: a few minutes on 4 threads.
- This machine is shared. Do not assume quiet cores.
- Found on 2026-12-02, and the reason this ticket matters. The same build ran at 289 and
then 39 steps per second on 4 threads within one minute, because other agents were
testing. A single run compared with a stored number is therefore not evidence on this
machine. Whatever the check does, it has to tell "the code got slower" from "the machine
was busy" by itself: for example by running the old and new builds turn about in the same
minute, by repeating until the spread is small, or by counting work instead of time where
that is honest. Choose the method by testing it under real load, with agents running, and
show that it neither cries wolf on a busy machine nor misses a planted 10% slowdown. See
the hand-written note at the end of
docs/perf/LOG.md. - The runner (T-012) and the fields (T-011) are merged.
runner benchstill uses the testbed soup. Real worlds do not exist until T-009, T-010, T-017 and T-018 land, so build the suite so that worlds are added by dropping in a config, not by editing code.