Same rule as with all software; unless you are required to, NEVER optimise code.
While the optimised code might execute more efficiently, it'll have reduced your efficiency at writing & maintaining it.
Computers get faster; humans do not.
Exactly. make it easy to read/follow #1
Only 'optimize' or care about it, when you are 'profiling' and not because you think you are smarter than the compiler.
Most of the time people's optimization actually may make it worse. Do not rely on your 'gut' and intuition. Believe in the profiler
! and what actual performance changes occur. when you try to optimize code.
At the very least, run some sample real world conditions to test it 'new optimization'
For those who have understanding of where you deal with computational time, O(n) for worst case, average case, best case. Just because you optimize for best case, doesn't mean you don't make a horrible worst or average case. So be cautious with your 'samples' and test conditions