Laziness is the Root of All Evil

In a class a few days ago, the instructor trotted out Donald Knuth’s famous quote about premature optimization. Of course, as nearly every other instructor has ever done, he cherry-picked the catchy middle part: “Premature optimization is the root of all evil.” He did not, however, share the context around it. Here’s the full quote:

“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%”

“Premature optimization is the root of all evil” has given programmers carte blanch to ignore even basic performance optimizations. These “rough solutions” inevitably cascade into inefficient monstrosities that, over time, ossify into the dreaded tech debt that plagues this field. No programmer should agonize over perfect code all the time, but Donald Knuth gave them an inch and they took a mile. We have a responsibility to write good code always and perfect code sometimes. Premature optimization may have started out as the root of all evil, but over the years, laziness has taken its place.

Permalink.