On Sep 17, 2011, at 2:54 PM, Sam Tobin-Hochstadt wrote: >>> There's an excellent overview of how to write >>> high-performance JavaScript code by David Mandelin here: >>> >>> http://blog.mozilla.com/dmandelin/2011/06/16/know-your-engines-at-oreilly-velocity-2011/ >> >> this has been linked in the post itself and I know those slides and I have >> asked him personally questions ... questions that I really would like to >> understand in this ML before I update my post so that I can provide a proper >> feedback about my doubts. > > However, you don't seem to have fully read the slides. As he says "Do > not use [eval] anywhere near performance sensitive code". The > Function constructor is a version of |eval|.
An exception, or special case if you will: using Function or eval up front, hoisted and common'ed out of loops, and (this is crucial) not called from a function that you want optimized, in order to generate optimized JS. This kind of "query optimization" or JS-in-JS specialization is done, e.g. by ExtJS and other Ajax libraries. Also by a simple assembly-to-JS trace compiled emulator that Robert O'Callahan blogged about here: http://robert.ocallahan.org/2010/11/implementing-high-performance-emulator_01.html /be _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss