4 ms·
You are, of course, correct. My hypothesis (as someone who used to work on a JS VM) would be that locations of iterations over an object's keys and the creatio
by gsnedders 8y ago
You are, of course, correct.
My hypothesis (as someone who used to work on a JS VM) would be that locations of iterations over an object's keys and the creation of the object are almost always in different functions, with the object passed between them. And note that JS VMs rarely do cross-function optimization. As such, it would be exceptionally rare for the optimization to be applied.
My point was really that you can't always drop the ordering of properties, and the insertion order isn't something you can recreate after the time if you don't store in initially, hence you do really need to store it somehow.
(If anyone's confused, I edited the grandparent comment of this to better reflect the above.)