On Fri, Apr 8, 2011 at 13:24, Brendan Eich <[email protected]> wrote: > On Apr 8, 2011, at 12:59 PM, David Bruant wrote: > >> I'll agree that as long as it's fast enough for real life uses, the >> actual big-O or multiplicative constants are of no interest. For >> instance, the current inheritance has a O(n) complexity (prototype chain >> traversing), but in real life, I've never seen a prototype chain with 10 >> elements. > > See under http://sss.cs.purdue.edu/projects/dynjs/, > > http://sss.cs.purdue.edu/projects/dynjs/pldi275-richards.pdf > > Figure 6 attached below shows some tall chains for gmail. > > I'm told the Closure Compiler's optimizations tend to lengthen prototype > chains, but I don't know more than that. Arv may ;-).
That is not true. The compiler doesn't do this as far as I know. I know it didn't do this when it was first released and things might have changed but I highly doubt that we would do such a thing. I think the confusion comes from the inherit pattern in Closure Library [1]. I've seen people misunderstanding how that works, thinking that it adds another object in the prototype chain. [1] http://www.google.com/codesearch/p?hl=en#9XMP1FG0vX8/trunk/goog/base.js&q=goog%5C.inherits&sa=N&cd=1&ct=rc&l=1141 -- erik _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

