4 ms·
The idea behind not optimizing prematurely is there are some optimizations that come at a cost of decreased maintainability/readability. Not prematurely optimiz
by dusklight 15y ago
The idea behind not optimizing prematurely is there are some optimizations that come at a cost of decreased maintainability/readability. Not prematurely optimizing means choosing to prioritize your code structure to allow no-unexpected-side-effects changes and easy readability by other people, but it is not an excuse to use a O(n^2) algorithm when an O(n) algorithm can be used without cost. You should always be aware of the ballpark O(n) of your code, but in the initial stages of a project you might choose to prioritize other things.
- brazzy 15y agoI suspect the idea is more that people keep obsessing (and wasting time) about bullshit like whether iterating though a for loop forwards or backwards is faster, or whether they should have public fields to avoid the method overhead from accessors - stuff that is truely, utterly irrelevant except possibly in the most extreme hot spots.