I worry most people don't get the point of the Knuth's quote "Premature optimization is the root of all evil".
Here is the full 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%."
What most people do is ALSO pass up optimizing that critical 3%, so software gets slower and slower. What he (probably) really meant is: "don't micro-optimize what a compiler can do better, optimize your algorithms and data-structures"
Some common excuses for bad code:
- Shuffling data around needlessly? Not a problem. It's fast enough.
- The algorithm is bad. Not a problem. It's fast enough.
- This is obviously bad. Not a problem. It already takes minutes, so a few more won't matter.
- The code is slow. Not a problem. It's only used internally.
Here is the full 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%."
What most people do is ALSO pass up optimizing that critical 3%, so software gets slower and slower. What he (probably) really meant is: "don't micro-optimize what a compiler can do better, optimize your algorithms and data-structures"
Some common excuses for bad code:
- Shuffling data around needlessly? Not a problem. It's fast enough.
- The algorithm is bad. Not a problem. It's fast enough.
- This is obviously bad. Not a problem. It already takes minutes, so a few more won't matter.
- The code is slow. Not a problem. It's only used internally.