geepawhill.org/optimizing-a-p…
So when I optimize for my performance rather than the code's performance, I focus first on scannability.
openTheDoor()
getInTheSeat()
closeTheDoor()
TurnTheKey()
StepOnTheAccelerator()
seat.put( body.parts["ass"].substring(2,9).
if( condition ) { // multi-statement blah-blah-to-do-the-thing }
else { // multi-statement other thing }
becomes
if(condition) doTheThing()
else otherThing()
This depends on whether the two branches are really doing the same "thing" using different techniques, an extremely common situation.
Have a lovely late Thursday night! Tomorrow's another day in the silicon mines.