This loop chases a concrete metric (load time, bundle size, p95 latency) until it drops below budget.
The cycle profiles, finds the single biggest bottleneck, applies one optimization, re-measures, and confirms no test broke.
It stops only when the metric stays within budget across several consecutive runs, with no functional regression.
The rule is one improvement per pass, always with the number truly measured.
When to use
- When there is a performance budget to meet.
- To cut bundle size, latency, or load time in a controlled way.
- When you want stable gains, not a lucky number.
How to use
Run the loop asking it to measure against the budget, fix the biggest bottleneck, re-measure, and continue until the metric holds within target across consecutive runs.