🌐 Software · Thinking

Knuth's Premature Optimization

"Premature optimization is the root of all evil"
📅 1974 👤 도널드 크누스 📖 早

Origin

From Donald Knuth's 1974 ACM paper "Structured Programming with go to Statements". Full quote: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." Often truncated, but the key is the 97% — optimization before measurement is worse than wasteful, it is harmful.

Meaning

Engineer's instinct: "This part looks slow, let me optimize first." Knuth's discovery: our intuition is almost always wrong. Real slow code only shows under measurement. There are 10% of lines consuming 90% of time, and only profiling reveals them. Optimization without measurement only complicates code.

Lesson — Meeting Eastern Classics

Analects 13.17: "If you want it fast, you won't arrive." Confucius's warning of haste. Knuth showed how the trap operates in code — the desire for speed makes code slower.

Essence in One Hanja

"早" combines sun (日) with ten (十) — the sun risen, early. Analects 15.37: "A gentleman is firm but not narrowly faithful." Those bound to 早 (premature) optimization are bound to small fidelity, missing the great firmness.