I don’t think this is meant to be hand written though. But a bundle/compiler can do this optimization for you.
I wonder how many such tweaks it would take it to be worthwhile for companies to add it as a build step
This particular hack is absolutely nothing you have to worry about, just like esoteric performance tweaks available in any language stack. Write the JS you need and use it. Then profile and optimize as necessary.
It just seems like a human nature to paper over.
It’s an evolution.