Back to articles
Giving V8 a Heads-Up: Faster JavaScript Startup with Explicit Compile Hints

Giving V8 a Heads-Up: Faster JavaScript Startup with Explicit Compile Hints

via V8 BlogMarja Hölttä

Getting JavaScript running fast is key for a responsive web app. Even with V8's advanced optimizations, parsing and compiling critical JavaScript during startup can still create performance bottlenecks. Knowing which JavaScript functions to compile during the initial script compilation can speed up web page loading. When processing a script loaded from the network, V8 has to choose for each function: either compile it immediately ("eagerly") or defer this process. If a function that hasn't been compiled is later called, V8 must then compile it on demand. If a JavaScript function ends up being called during page load, compiling it eagerly is beneficial, because: During the initial processing of the script, we need to do at least a lightweight parse to find the function end. In JavaScript, finding the function end requires parsing the full syntax (there are no shortcuts where we could count the curly braces - the grammar is too complex). Doing the lightweight parsing first and the actual

Continue reading on V8 Blog

Opens in a new tab

Read Full Article
4 views

Related Articles