Worked example · Performance

Getting a port from 5 FPS to 60 with Whiplash Driven Development

Performance work is WDD with a number as the finish line: the agent measures, finds the biggest cost, changes one thing and measures again, round after round, until the frame rate reaches the target, while the correctness checks stay green.

The goal

Raise the average frame rate of a benchmark scene from 5 to at least 60 frames per second on the reference machine, with no visual differences.

The verifier

A headless benchmark run that prints the average frame time, plus a screenshot comparison against reference frames.

Why this check: Two checks: one for the number that must go up, one that stops the agent from "winning" by drawing less.

The set-up

  • A scripted benchmark scene that runs without a person and prints its result.
  • Reference screenshots, compared with a small tolerance.
  • A profiler the agent can run from the command line.
  • A results table in NOTES.md: change, frame time before, frame time after, kept or reverted.

The kickoff prompt

Kickoff

Target: average frame rate of at least 60 in the benchmark scene (now 5). Each round: run the profiler, take the single biggest cost, make one change, run the benchmark and the screenshot check. Keep changes that help and pass, revert the rest, log every result. Keep going until 60.

How the rounds went

Rounds 1 to 4
The profile points at shader compilation on every frame. Caching compiled shaders takes the scene from 5 to 22 FPS.
Rounds 5 to 11
Each round takes the next biggest cost: redundant state changes, a texture upload in the hot path, a debug check left on. 22 becomes 48. Two changes fail the screenshot check and are reverted.
Rounds 12 to 15
Gains get small. The push turns to "measure, do not guess", and the agent finds a lock held across the render thread. 63 FPS, screenshots identical.

What worked

  • One change per round, measured: the results table shows exactly which change bought which frames.
  • The screenshot check, which caught two "optimisations" that simply skipped drawing.
  • Profiling before each change instead of letting the agent guess.

What to watch for

  • Benchmarks are noisy. Run each measurement several times and compare medians, or the agent will chase noise.
  • An agent told to make a number go up will find ways to fake it: lower quality settings, skipped frames. Check what it changed.

Build a kit for a task like this

A worked example written to show the method, not a report of a specific project.

Questions people ask

Can WDD fix performance on its own?

It can grind through the measured, mechanical part very well. Deciding which visual trade-offs are acceptable is still a human call; write those limits into the checks.

What does "FPS: 5" have to do with WDD?

Early in the community effort that gave WDD its name, the running game was famously slow; the meme of the band leader pushing for more became shorthand for pushing an agent from "it boots at 5 FPS" to "it runs".

More examples