This is always a tradeoff.
First, the computeringcomputer industry is about money at the end. What you need to do as a developperdeveloper is generate value for customer so you get money (that's an oversimplification but the main point is here).
DevelopperDeveloper time costcosts money. Machine power costs money too. Usually, this second costscost is way lower than the first one. So, this is capital to have a readable code and maintenablemaintainable code, so develloperdeveloper can spend most of theuretheir time delivering value.
microMicro-optimisationoptimization can, in some case, be important. But they usually involve less readable code, or less extendable code (this is not the case of your linked exempleexample, but in general, it is). This will cost at some point developper'sdeveloper's time. This time beeingbeing more expensive than machine power, this is a waste.
Second, micro-optimisationoptimization in a large project can make it harder and harder to maintain/make evolveevolve. The problem with that is that when evolving, some other optimisation may be now impossible to do. With an evolving application, you'll typically endsend up with a solution that is slower than what you would have gothad without doing thoses optimisationthose optimizations.
Third, the optimization is often irrevelant as algorithm complexity will generally overcome any micro-optimisationoptimization you could have done if the data set grows. Sadly, as micro-optimisationoptimization make your code harder to maintain/evolve, thoses optimisation may be harder to do.
Sometime, the value is in this optimisationoptimization (think about latency critical programs, like in video games or an aircraft's autopilot). But this has to be demonstrated. Usually, your program spend most of the time in a limited portion of code. Whatever micro-optimisationoptimization you do, you'll never get your programs any valuably faster without identifying the bottleneck and work on this part.
Asking your question as you did showed that you didn't benchmarkedbenchmark the problem on an actual program. In this case, you could have do the trick and noticed if it was faster or not. So you wherewere asking that before having any problem. This is where the problem is. You were handling the problem of optimisationoptimization the wrong way.
As maintenance and evolution are usually more valuable than micro-optimisationoptimization, be sure to have the right interface before doing any. Then if parts of your program are abstract enough for one another, you can micro-opmiseoptimize one without messing up the whole thing. This requirerequires that your interface is running for long enough to be trusted.