Re:Why the New V8 Is So Damn Fast
by fasquoika on Monday July 30, 2018 @07:37PM
(#17649236)
The original code didn't have a call to .keys(), and that's the case where this should be optimized. If you do the unordered optimization, then encounter an operation that needs an ordered iteration, you'd have to fall back to an ordered representation (which could be slower than not doing the optimization at all)
[ Parent
| on HN ]
Re:Why the New V8 Is So Damn Fast
by MikeHolman on Monday July 30, 2018 @08:32PM
(#17649572)
That requires extra bookkeeping for ordering, but it isn't really that common where people will have object literals with the same properties initialized in a different order.
But a much more common case is that properties added after object creating will be added in an inconsistent order, for example:
o = {}; o.x = 1; o.y = 2; o.z = 3;
p = {}; p.y = 4; p.x = 5; p.z = 6;
When executing p.y = 4 you don't know that the object will eventually evolve to have the same properties as o.