My ECMAScript 7 wishlist
brendan at mozilla.org
Fri Sep 26 09:17:05 PDT 2014
Dean Landolt wrote:
> Sure, O.o isn't free, and I get that using @noSuchProperty would
> likely result in all kinds of deoptimization. But of all the costs
> listed in that thread, I'm not seeing any mention of the cost of
> intercepting changes for notification queueing.
You may have missed these points, then:
Finally, just to clear up some myths, observation is nothing close to
free inside V8 either:
- Observing an object slows down all its mutations severely, easily by
10x-100x, depending on the case.
- It invalidates a range of routine optimisations, especially for bulk
mutations like on arrays. Essentially, observing an object forces
every potentially impure operation on it onto the slowest path.
- Observation introduces additional type polymorphism, which can cause
even unrelated optimisations to fall off the cliff.
Most of these costs are inherent to the mechanism, and there probably
isn't much of a chance that they can be optimised by more than
> I'm assuming this has to be part of any O.o implementation (IIUC the
> only alternative would be polling observed objects every turn). More
> importantly that must already paid for all observed objects. You made
> the comment "Good luck selling implementors", and I was just wondering
> aloud whether they've already been sold on doing the heavy lifting for
> the sake of O.o.
See my longer followup. A general-purpose (as its name implies) nSP
would hit lookup (get as well as set) paths, not just mutation (set).
But it seems Andreas's "just to clear up some myths" words were missed,
even considering only mutation (not notification).
More information about the es-discuss