JavaScript Start-Up Performance

Avatar of Chris Coyier
Chris Coyier on

Addy Osmani:

Smaller JavaScript bundles generally do result in a faster load time (regardless of our browser, device & network connection) but 200KB of our JS !== 200KB of someone else’s and can have wildly different parse and compile numbers.

Using file size as a metric isn’t an awful crime, because it does matter, but it’s only part of the JavaScript performance story.

I also found the overview of the discussion of bytecode interesting. Browsers download JavaScript, parse it, turn it into an abstract syntax tree, then turn that into bytecode. What if we could do that during our build steps and ship bytecode?

My opinion is shipping bytecode can increase your load-time (it’s larger) and you would likely need to sign the code and process it for security. V8’s position is, for now, we think exploring avoiding reparsing internally will help see a decent enough boost that precompilation may not offer too much more, but are always open to discussing ideas that can lead to faster startup times.

Direct Link →