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

DevFeed: [Giving V8 a Heads-Up: Faster JavaScript Startup with Explicit Compile Hints](<https://devfeed.tech/articles/giving-v8-a-heads-up-faster-javascript-startup-with-explicit-compile-hints-3521.md>)

Original publisher: [Read original article](<https://v8.dev/blog/explicit-compile-hints>)

Author: Marja Hölttä

Published: 2025-04-29T00:00:00Z

Content type: article

Language: en

Sources: [V8](<https://devfeed.tech/sources/v8.md>)

Topics: [V8](<https://devfeed.tech/topics/v8.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Chrome](<https://devfeed.tech/topics/chrome.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [chrome](<https://devfeed.tech/tags/chrome.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>), [performance](<https://devfeed.tech/tags/performance.md>), [speed](<https://devfeed.tech/tags/speed.md>), [thread](<https://devfeed.tech/tags/thread.md>), [web-app](<https://devfeed.tech/tags/web-app.md>), [web-developers](<https://devfeed.tech/tags/web-developers.md>)

## AI overview

The article explains how V8 chooses between eager and deferred JavaScript compilation and how Explicit Compile Hints can improve startup performance. It describes Chrome 136 support for selecting individual files for eager compilation, while warning that compiling too much can increase time and memory use.

## Source excerpt

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 parsing afterwards is duplicate work. If we decide to compile a function eagerly, the work happens on a background thread, and parts of it are interleaved with loading the script from the network. If we instead compile the function only when it's being called, it's too late to parallelize work, since the main thread cannot proceed until the function is compiled. You can read more about how V8 parses and compiles JavaScript in here. Many web pages would benefit from selecting the correct functions for eager compilation. For example, in our experiment with popular web pages, 17 out of 20 showed improvements, and the average foreground parse and compile times reduction was 630 ms. We're developing a feature, Explicit Compile Hints, which allows web developers to control which JavaScript files and functions are compiled eagerly. Chrome 136 is now shipping a version where you can select individual files for eager compilation. This version is particularly useful if you have a "core file" wh