OK, thanks, that answers my question! [>] Brian
> On Jun 22, 2016, at 7:31 AM, Isiah Meadows <[email protected]> wrote: > > For what it's worth, engines already optimize for static object layouts. So > if you never change the property set for instances of that class, the struct > won't help performance much in practice. Similarly, standard arrays with just > numbers are almost as fast as typed arrays as well, so unless you're in > serious performance critical, likely asm.js, code, you might get a 0.5% boost. > > > On Mon, Jun 20, 2016, 11:20 Brian Barnes <[email protected] > <mailto:[email protected]>> wrote: > As far as I can read, Typed Objects/Structs are in consideration for a > later version of ecmascript (but not in the spec) and there exists some > implementations. It depends on the engine, but has there been any > thought to how costly they might be to fake at least some rudimentary > type support? For instance: > > class point2D > { > constructor() > { > this.props=new Structure({ > x:uint32, > y:unit32 > }); > } > > setMe(x,y) { > this.props.x=x; > this.props.y=y; > } > } > > This doubles the property lookups but that can probably be optimized > away (maybe) -- but it does force the engine to consider x/y as always > ints. Of course, this doesn't do anything about the function signatures. > > I don't think types are coming anytime soon, and just wondering if, in > the future, messy code like this might be worth it, or otherwise, to let > implementers know this is something that people might try with their > code and would be an interesting path to look at. > > [>] Brian > _______________________________________________ > es-discuss mailing list > [email protected] <mailto:[email protected]> > https://mail.mozilla.org/listinfo/es-discuss > <https://mail.mozilla.org/listinfo/es-discuss>
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

