3 ms·
> you're saying premature optimization isn't the root of all evil. Maybe it's time to retire this tired 'conventional wisdom' Funny you mention it. I have a bi
by dahart 4y ago
> you're saying premature optimization isn't the root of all evil. Maybe it's time to retire this tired 'conventional wisdom'
Funny you mention it. I have a bit of a habit now of reminding people what the remainder of Knuth’s quote actually was.
“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%.”
The irony of walking away with the impression that Knuth was saying to not do optimization is that his point was the exact opposite of that, he was emphasizing the word premature, and then saying we absolutely should optimize, after profiling.
This all agrees completely with the article’s takeaways: build it right first, then measure, and then optimize the stuff that you can see is the slowest.
- astrange 4y agoThe 97% does have its own performance opportunities; rather than making it faster you want to stop it from getting in the way of the important stuff, by reducing code size or tendency to stomp on all the caches or things like that. Anyone optimizing via microbenchmarks or wall time exclusively isn’t going to see this.