W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] Script loading and execution order for importScripts

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 07 Mar 2009 15:51:53 -0500
Message-ID: <49B2DE69.8010005@mit.edu>
Oliver Hunt wrote:
> If by "compilation" you mean you're (effectively) just doing a syntax 
> check then webkit is able to this, although it has a reasonable cost 
> associated with it

"Compilation" in this case is parsing and compilation to SpiderMonkey 
bytecode.  This does include syntax checks, of course, but also an 
optimization pass (constant folding, some simple dead expression 
elimination, that sort of thing) and produces the actual object that can 
be executed (which is quite distinct from the character array that is 
input to the compilation process).

This is not a trivial cost at the moment: it's about 10-20% of the cost 
of loading and executing some of the large scripts out there which have 
all sorts of function definitions but don't immediately run all the code 
(e.g. the scripts loaded by gmail).

-Boris
Received on Saturday, 7 March 2009 12:51:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT