3 ms·
> Knuth is right: premature optimization is a bad idea, full stop. A bit of a "no true Scotsman" though, isn't it? Any optimization that is a good idea to do n
by biot 11y ago
> Knuth is right: premature optimization is a bad idea, full stop.
A bit of a "no true Scotsman" though, isn't it? Any optimization that is a good idea to do now is "not truly premature", whereas everything else is actually premature.
- gutnor 11y agoBut that's basically every rule or guideline in the software world. You should do X always, unless it does not make sense. How do you know the difference ? With enough experience or enough ignorance. Knowing when you are in one category or another for a specific topic is the tricky bit.
- biot 11y agoI'm going to have to agree with ska's other comment[0] and say that it's knowing the difference between good design and optimization. Being able to design a performant system means choosing designs which are inherently fast. Squeezing the last few percent out of bubble sort makes no sense when you should have gone with, say, insertion sort in the first place. Once you have the right algorithms, data structures, and system architecture in place and working, it's going to be fast enough and you can choose to spend time optimizing only where absolutely necessary. Even then, you should default to getting order of magnitude better performance via a better design rather than tweaking inefficiencies. [0] https://news.ycombinator.com/item?id=11284817 https://news.ycombinator.com/item?id=11284817