34
Performance
Premature Optimization
Misallocated Engineering Cost.
The article
If
"Premature optimization is the root of all evil." Optimizing code before measurement proves it matters wastes engineering hours, adds complexity, and obstructs the eventual real optimization by entangling hot and cold paths.
Then
“Write the obvious code first. Only optimize hot paths that a profiler proves are bottlenecks. Leave the other 97% of the code simple — that's where the next maintainer will live.”
Unless
Profile First / Make It Work, Make It Right, Make It Fast (in that order)
Source
Donald E. Knuth, Structured Programming with go to Statements (Computing Surveys, 1974).
Go to the sourceSee also