5 ms·
> Pike's rules 1 and 2 restate Tony Hoare's famous maxim "Premature optimization is the root of all evil." Looks like wrongly attributed to Hoare? That famous
by avinassh 9y ago
> Pike's rules 1 and 2 restate Tony Hoare's famous maxim "Premature optimization is the root of all evil."
Looks like wrongly attributed to Hoare? That famous quote is by Knuth
http://wiki.c2.com/?PrematureOptimization http://wiki.c2.com/?PrematureOptimization
https://en.wikiquote.org/wiki/Donald_Knuth https://en.wikiquote.org/wiki/Donald_Knuth
- dws 9y agoThere's some debate about that. Knuth at one point (in Literate Programming) attributes it to Hoare, and Hoare later attributes it to Knuth.
- deleted 9y ago[deleted]
- mpweiher 9y agoFull 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.