October 2004
Intermediate to advanced
240 pages
6h 22m
English
Spur not a willing horse (Latin proverb): Premature optimization is as addictive as it is unproductive. The first rule of optimization is: Don’t do it. The second rule of optimization (for experts only) is: Don’t do it yet. Measure twice, optimize once.
As [Stroustrup00] §6’s introduction quotes so deliciously:
Premature optimization is the root of all evil.
—Donald Knuth [quoting Hoare]
On the other hand, we cannot ignore efficiency.
—Jon Bentley
Hoare and Knuth are, of course and as always, completely correct (see Item 6 and this Item). So is Bentley (see Item 9).
We define premature optimization as making designs or code more complex, and so less readable, in the name of performance when ...