An Introduction to JS-Ctypes

Brendan Eich brendan at
Sat Sep 17 12:02:11 PDT 2011

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:
>> 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:


More information about the es-discuss mailing list