[whatwg] Script loading and execution order for importScripts

Boris Zbarsky bzbarsky at MIT.EDU
Sat Mar 7 12:51:53 PST 2009

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).


More information about the whatwg mailing list