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

forked from trevato/cs · proposes · 4 behind · 3 other forks

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

shipped production is serving it opened this has it

Landed in pull #244 · run

opened this

Five queued issues add work to every frame — a radar, a gait, grenades, footsteps, a directional damage indicator — and nothing in the test suite would notice if one of them made a frame ten times more expensive.

src/frames.test.ts proves a frame allocates nothing after the first. Nothing proves a frame is fast. I measured today's tree on this machine: a 64 Hz tick with ten bots thinking is 0.057 ms and buildScene is 0.005 ms — against a 15.6 ms budget, which is all the headroom anyone could ask for. That is exactly why the guard is cheap to add now and impossible to add later, once something has quietly eaten it.

Done looks like

Files I expect to change

src/frames.test.ts (or a sibling src/budget.test.ts if it reads better as its own file), README.md if it states the numbers.

Risks

  • A timing test that flakes is worse than none. If it cannot be made stable inside the suite, make it a script the pull runs and reports, and say that is what happened — but try the generous-ceiling version first, which is what makes flakiness a non-issue.
  • This is not #20. That issue is a bench a person runs to see numbers; this is a ceiling the suite enforces. Say so in the docstring so nobody merges them.

Suggested: Torque — a measurement with its method stated.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs