News for hackers. Stuff that matters.
Re:Classical Inheritance in JavaScript by yuchi on Monday November 05, 2012 @05:21AM (#4742921)
Please, do not consider this article as normative.

Anyone trying to learn JS should have a look to more recent articles.

Examples:

- http://bonsaiden.github.com/JavaScript-Garden - Good insight

- https://developer.mozilla.org/en-US/docs/JavaScript - Good place to start learning, and for experienced developers a good place to contribute to

- https://duckduckgo.com/?q=javascript+inheritance+performance - Search for performance issues

PS: recently I found an article (probably here on HN) describing how v8 treats prototypes, and how to not break the performance boost given by v8 assumptions. Can someone remember which one was?

Re:Classical Inheritance in JavaScript by shantanubala on Monday November 05, 2012 @05:39AM (#4742957)
Though I don't know of an article, this video from a while ago describes (at a high level) the "hidden classes" that represent prototypes. It was part of the original launch of Chrome about 4 years ago. Some of the related videos have more info, but basically V8 represents prototypes as classes that act as a cache for the properties, so the lookup of properties within the prototype becomes much faster than a lookup for an ordinary property of an object.

http://www.youtube.com/watch?v=hWhMKalEicY

EDIT - Your comment inspired me to do some additional Googling -- here's another (text-based) description that's a little clearer: https://developers.google.com/v8/design#prop_access

Re:Classical Inheritance in JavaScript by yuchi on Monday November 05, 2012 @05:52AM (#4742982)
Exactly what I was looking for!