5 ms·
Backbone uses proper prototypal inheritance ... so I'm not sure which "most libraries" he's comparing to there. In fact, Spine doesn't use "JavaScript's native
by jashkenas 16y ago
Backbone uses proper prototypal inheritance ... so I'm not sure which "most libraries" he's comparing to there.
In fact, Spine doesn't use "JavaScript's native prototypal inheritance", which, if we're being honest, is the use of constructor functions with prototype properties. It uses an emulated version of Object.create:
https://github.com/maccman/spine/blob/master/spine.js#L79-119 https://github.com/maccman/spine/blob/master/spine.js#L79-11...
... which, even when natively implemented, is quite a bit slower than the real thing:
http://jsperf.com/new-vs-object-create http://jsperf.com/new-vs-object-create