by londons_explore · 6y ago · 0 comments
Just write the code to describe what you really wanted to do, and if that performs badly, open a bug with V8 or other JavaScript engines to optimize it.
If there are two identical ways to write the same code, the engine is what should be deciding what's fastest and running that.
In this case, it probably ought to be pulling the "x" field out of this structure and doing a memset() on the whole thing.
In addition, I really, really wish more JS developers actually cared to learn about optimization and about how the runtime/hardware actually works. We've "developed" the web to such a slow, buggy mess that I've given up on the idea that there's any way to fix it. I hope somebody figures out a way to start over, preferably with no scripting capability, because apparently giving people any half-baked scripting language results in them soon developing nuclear footguns with it.
The change in question is JEP 280.
Optimise after. BTW, I thought it is about memory leak which is seriously not performance tuning!