On 11/2/16 9:04 AM, kdex wrote:
I'd imagine that from an engine point of view, this means that fewer
object shapes land in memory, at least for v8.

I'm pretty sure it means nothing of the sort in SpiderMonkey (in terms of memory usage, not in terms of object shapes that flow through subsequent shape guards), for what it's worth. I'm not sure it's worth adding things to the standard just to work around implementation quirks of a specific implementation.

No opinion on the ergonomics argument.

Reducing the number of object shapes currently boils down to using an
object literal and setting the properties to `value || null` instead of
extending the object with new properties imperatively.

This actually creates _more_ object shapes in SpiderMonkey, I believe, though fewer shapes that flow through code locations. So it depends on whether you're trying to optimize memory usage or performance. And of course on whether you're tuning to a particular engine's current implementation strategy...

-Boris
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to