tezvyn:

Chrome 136 cuts JS startup 630ms with compile hints

AI-drafted, machine-checkedSource: V8 Blogintermediate

Chrome 136 ships Explicit Compile Hints, cutting parse and compile times by 630ms in V8 tests. The //# allFunctionsCalledOnLoad comment triggers eager background compilation for entire files, avoiding main-thread bottlenecks.

WHY IT MATTERS: JavaScript startup performance directly impacts how responsive your web app feels. When V8 processes a script, it must decide for each function whether to compile it immediately or defer that work. If a deferred function is called during page load, V8 must compile it on the main thread right when it is needed, blocking execution. This is especially painful because V8 must do a lightweight parse to find function boundaries during initial processing, then parse again when compiling, creating duplicate work. By moving compilation to background threads during network load, you eliminate main-thread jank for critical startup paths.

WHAT CHANGED: Chrome 136 is shipping file-based Explicit Compile Hints. You can now add the magic comment //# allFunctionsCalledOnLoad to the top of a JavaScript file, and V8 will eagerly compile every function in that file on a background thread before it is called. In V8 experiments with popular web pages, 17 out of 20 sites showed improvements, with an average reduction of 630 milliseconds in foreground parse and compile times. This version is file-scoped, so it is most useful when you have a known core file that runs during startup, or when you can refactor code to group startup logic into a single file. The alternative is compiling on demand, which cannot be parallelized with network loading and forces the main thread to wait.

WHAT TO WATCH: Use this feature sparingly. Eagerly compiling too many files wastes memory and CPU without improving performance, since background thread work still consumes resources. Start by identifying which JavaScript files execute during your initial page load. If you have a clear core bundle or entry point, add the comment there and measure the impact on your page load performance. The feature is being developed under the WICG Explicit Compile Hints proposal, and the API may expand to function-level granularity later.

Read the original → v8.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.