Performance

Premature Optimization

Premature optimization is the root of all evil.

performance optimization design

Donald Knuth famously stated: We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.

The Full Quote (Often Missed)

Knuth also said: Yet we should not pass up our opportunities in that critical 3%. The point is not to never optimize, but to:
  1. Profile first — identify actual bottlenecks
  2. Optimize the right 3% — focus on hot paths
  3. Don't sacrifice readability for marginal gains

Write clear code first, then measure, then optimize.

Enforce this law (and 100+ more) in your AI coding agents with DevLaws.

Open DevLaws All laws →