DEV Community

Discussion on: Stop Writing JavaScript Like This

 
peerreynders profile image
peerreynders • Edited

You've completely lost sight of what matters and have gone off on a tangent.

The issue is the difference between "efficient coding idioms" vs. "premature optimizations".

If your application has to only work over a cooperate intranet with a strictly standardized web browser it's easy to determine what works and what doesn't. Over the public web matters are much more complicated and much less predictable especially when JavaScript is involved. So the blanket

These kinds of performance optimizations don't matter. At all

without consideration of any type of context is entirely inappropriate. For example the iteration mechanism that is consistently performant across the majority of situations is the plain for loop. Does that mean bad things will happen if you prefer array functions? Not likely but context matters. As always — it depends.

The other issue is that current benchmarks don't typically cover memory pressure.