by andrepd · 2y ago · 0 comments
What Knuth means is "don't waste time microptimising parts of your code which aren't bottlenecks anyway". Yet when this is cited it's basically taken as "don't give a thought about optimisation until later on, instead do things the easiest way for you as a dev".
The irony is that doing so barely optimises anything. The optimisations aren't so much premature as... Not optimisations. I'm a big fan of Casey Muratori's video where he compares 3 things commonly called optimisation:
- actual optimisation, which is detailed work involving profilers and evidence
- fake optimisation, like using fast inverse square root in a web app because you heard it was faster
- non-pessimization, where you just try to write straightforward code without introducing major performance regressions without good reason
"Premature optimisation" is probably just "fake optimisation".