Runar Ovesen Hjerpbakk

Science-based software development

Premature Optimization

Donald Knuth once wrote our most often misunderstood quote:

Premature optimization is the root of all evil.

Which in context reads:

Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

"What premature optimization means is an optimization that has a little impact but keeps the programmer or designer busy during the design phase to change the design significantly. This, of course, is very different from many of the circumstances where a recommended practice is not followed or a small change without affecting the design can give us better results."

(Via Keyvan Nayyeri.)