Premature optimization is the root of all evil

“Premature optimization is the root of all evil.” is a popular quote with mysterious origins. It is widely attributed to Donald Knuth, who apparently used it in Structured Program with goto Statements but later credits Tony Hoare.

Hoare, however, did not claim it when I queried him in January of 2004:

Dear Hans,

I’m sorry I have no recollection how this quotation came about.? I might have attributed it to Edsger Dijkstra.

I think it would be fair for you assume it is common culture or folklore.


Bruce Eckel also credits Dijkstra. Now that would be ironic, since the widely-attributed first use by Knuth was written as a rebuttal to Dijkstra’s Go To Statement Considered Harmful.

I posted this in August 2004 during week 1588.

For more, you should follow me on the fediverse: