4 ms·
Interestingly, the 2nd argument to Object.create was specifically designed (by me) so that an object's "shape" could be statically determined. If the descriptor
by allenwb 16y ago
Interestingly, the 2nd argument to Object.create was specifically designed (by me) so that an object's "shape" could be statically determined. If the descriptor is all literals (they usually are) then each Object.create call site is essentially a construction site for a "class" of objects that share a common structure.
As Erik says, this should be fixable. It sounds to me like Crock's coding style is just ahead of the engine implementation curve. Hopefully it will help push this optimization into the actual implementations.
- mraleph 16y agoCrockford's code style is very peculiar: https://github.com/douglascrockford/JSLint/blob/master/jslint.js#L1494-1536 https://github.com/douglascrockford/JSLint/blob/master/jslin... (I really hope that this is not coding-style-of-the-future) As you can see single Object.create callsite becomes a construction site for objects that might _not_ share a common structure (they potentially have different prototypes).