*oops: obj.value = 0; Object.defineProperty(this, 'foo', obj); obj.value = 1; Object.defineProperty(this, 'foo2', obj);
On Mon, Sep 23, 2013 at 4:30 PM, J B <[email protected]> wrote: > *Would the former method help with reducing object allocation (and > therefore gc), or are there compiler optimizations that will automatically > make the latter as efficient? > > > On Mon, Sep 23, 2013 at 4:28 PM, J B <[email protected]> wrote: > >> var obj = {}; >> >> Object.defineProperty(this, 'foo', obj.value = 0); >> Object.defineProperty(this, 'foo2', obj.value = 1); >> >> vs. >> >> Object.defineProperty(this, 'foo', {value:0}); >> Object.defineProperty(this, 'foo2', {value:1}); >> >> >> Would the former method help with reducing object allocation (and >> therefore gc), or are there compiler optimizations that will automatically >> make the former as efficient? >> > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

