Premature optimization

“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%.”
“Donald Knuth [1]”
Since when did correct data typing in the production database become optimizations???

“ Comments on We'll Optimize Later [2]”

This is echoing a feeling I've had now for the past year or so—the phrase “premature optimization is the root of all evil” has been so drilled into programmers that it seems like no thought at all is being employed.

Technically speaking, writing code is “premature optimization.” Why bother even writing code when we can call upon the mighty powers of the lazy web [3] to see if it's been written already. Or something close. Heck, it doesn't even have to be close, as long as it's code that can be adapted (just try to ignore the time factor when it takes longer to adapt code than it would have taken to write code from scratch, which may make a better impedance match to the rest of your code).

So remember, thinking about your code is a form of premature optimization.

[1] http://www-cs-/

[2] http://worsethanfailure.com/Comments/We_0x27_ll_Optimize_Later.aspx

[3] http://www.lazyweb.org/

Gemini Mention this post

Contact the author