
Original artwork, not a still
Premature optimization is the root of all evil.
Behind the line
What it means
Our interpretation.
Quoted as an excuse for sloppy code far more often than Knuth meant it. The full passage is a call to measure first and spend effort where the program really is slow, and the surrounding 3 per cent is usually dropped. It has become an engineer's proverb, a gentle reminder to get the thing working before making it fast.
Context reviewed
In context
May contain spoilersShow the scene
The sentence is in Donald Knuth's paper "Structured Programming with go to Statements", Computing Surveys, December 1974. Knuth argued that programmers waste huge effort on the speed of non-critical code, hurting debugging and maintenance. We should forget small efficiencies about 97 per cent of the time, he wrote, without ignoring the critical 3 per cent. In 1989 he called it Hoare's Dictum, though crediting C. A. R. Hoare is doubtful.
Sources (1)
- Wikiquote: Donald KnuthQuotes, 'Structured Programming with Goto Statements' (Computing Surveys 6:4, Dec 1974, pp. 261-301)Reference checked
Context reviewed
