Public: anyone can read this; the crew can change it.

forked from trevato/cs

A frame has a budget and the tests hold it: the simulation and the scene, measured, with today's numbers as the floor #244

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`src/budget.test.ts` puts a ceiling under a frame: a warmed-up 64 Hz tick of ten bodies with nine bots thinking (**0.078 ms** today), `buildScene` on the hungry frame that tick leaves — bodies, the bomb down, a firefight still in the effect ring (**0.0096 ms**) — and `buildRangeScene` on a full lane (**0.0003 ms**), against the 15.625 ms a frame has. The ceilings are 1.0, 0.15 and 0.02 ms — thirte…

shipped production is serving it deploy ae07c2d

opened this

src/budget.test.ts puts a ceiling under a frame: a warmed-up 64 Hz tick of ten bodies with nine bots thinking (0.078 ms today), buildScene on the hungry frame that tick leaves — bodies, the bomb down, a firefight still in the effect ring (0.0096 ms) — and buildRangeScene on a full lane (0.0003 ms), against the 15.625 ms a frame has. The ceilings are 1.0, 0.15 and 0.02 ms — thirteen, sixteen and sixty-six times today's cost, larger where the number is smaller because jitter is absolute and not proportional — so a radar, a gait, grenades, footsteps or a damage indicator that made one of these an order of magnitude dearer fails the suite, and a slow runner does not. Every number is printed on a green run.

Stability is the part worth reading. Each measurement warms up (two batches discarded), takes the median of seven batches rather than one mean, and times every batch on two clocks — the wall clock and this process's CPU time — believing the smaller median, because both are upper bounds on the work and interference only ever pushes one of them up. Against 160 spinning processes on 80 cores the wall clock reads a tick at 7.8 ms, past any useful ceiling, while the CPU clock reads 0.43 ms and all three ceilings hold with four to twenty times over; at plain saturation the three read 0.27, 0.022 and 0.0010 ms. A fourth test steps the same 1/64 s in 64 substeps and requires that to breach the tick's ceiling, so a guard that had quietly stopped measuring anything would be caught. The file costs about 0.6 s; bun test went from ~20 s to ~20.6 s, inside its own run-to-run noise.

One thing here is not mine and is flagged as such: main at b45af3b carries three committed static/app.<hash>.js (#239, #236 and #240 each added one without removing the last), which fails eleven tests on the default branch before any change of this branch. The first commit is scripts/build.ts's own remedy — rebuild, one bundle, the stale two gone — so this pull's check can mean something; it is separate, and reverting it loses nothing else here. I did not touch #20's bench, and the docstring says plainly that this is a ceiling the suite enforces and not a bench a person reads.

🤖 Generated with Claude Code

Closes #160

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs