Let me do a optimization summary:
- Engineering time is the most valuable resource.
- Optimization is really about attempting to meet a set of goals with some metric for success. Not really those set of things that ideally your language and compiler should ideally be able to do auto-magically do for you. Those are ideally “compiler optimizations”. When one is attempting to beat their compiler and/or hold its hand, then best case situations one can only expect very small localized linear time increases and should be avoided unless exactly known to be necessary.
- Performing any task has an associated opportunity cost of twice the amount of time spent performing it.
- On considering speed increases, then the most important are algorithmic and data-structure oriented at the high level. And of these the most important are both non-linear and one that if a “bad” choice is made, then changing to a better option requires significant engineering time. Simple example: attempt to go from an unstructured world to some set of spatial partitioning.
- “premature optimization” is IMHO an oxymoron. This is because “no reasonable goal” is being moved toward. It is simply one example of wasting time. All of which are equally bad.