The most classic optimization advice is based on a complete misquote. Here is some critical context:
> t. The conventional wisdom shared by many of today's software engineers calls for ignoring efficiency in the small; but I
believe this is simply an overreaction to the abuses they see being practiced by pennywise-and-pound-foolish programmers
> in established engineering disciplines a 12 % improvement, easily obtained, is never considered marginal
> when it's a question of preparing quality programs, I don't want to restrict myself to tools that deny me such
efficiencies.
> 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%.
Keep in mind that in this case the argument is being made against goto, which is effectively an inlined `jmp` instruction that can do all sorts of insane things just to save a few instructions. This quote is discouraging a case where the complexity is extreme and the benefit is minor.
All that people can seem to remember is "premature optimization is the root of all evil".
> t. The conventional wisdom shared by many of today's software engineers calls for ignoring efficiency in the small; but I believe this is simply an overreaction to the abuses they see being practiced by pennywise-and-pound-foolish programmers
> in established engineering disciplines a 12 % improvement, easily obtained, is never considered marginal
> when it's a question of preparing quality programs, I don't want to restrict myself to tools that deny me such efficiencies.
> 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%.
Keep in mind that in this case the argument is being made against goto, which is effectively an inlined `jmp` instruction that can do all sorts of insane things just to save a few instructions. This quote is discouraging a case where the complexity is extreme and the benefit is minor.
All that people can seem to remember is "premature optimization is the root of all evil".
[PDF] https://dl.acm.org/doi/pdf/10.1145/356635.356640