3 ms·
Full Knuth 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
by mpweiher 9y ago
Full Knuth 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%."
1. It is only ever about small efficiencies.
2. And about small efficiencies in the 97% non-critical parts
So:
1. It is always valid to concern yourself with large efficiencies.
2. In the critical 3%, it is also legitimate to worry about small efficiencies.
For context, later in the same paper (Structured Programming with goto statements):
“The conventional wisdom [..] calls for ignoring efficiency in the small; but I believe this is simply an overreaction [..] In established engineering disciplines a 12% improvement, easily obtained, is never considered marginal; and I believe the same viewpoint should prevail in software engineering."
So his actual message is pretty much the opposite of what is attributed to him.
- fiddlerwoaroof 9y agoThe issue though is that optimizing for performance is, in most cases, optimizing for the wrong thing if it makes your code harder to understand, maintain and test.
- rdiddly 9y agoThe key is the phrase "easily obtained." Always balance the efficiency benefits against the programming costs, i.e. time & effort.