Chrome 136 Speeds Up Web Pages with New JavaScript Compile Hints Feature
Chrome 136 ships Explicit Compile Hints, allowing developers to mark JS files for eager compilation, cutting startup times by up to 630ms.
Chrome 136 Now Allows Developers to Flag Critical JavaScript for Early Compilation
Google’s V8 team has launched Explicit Compile Hints in Chrome 136, a feature that lets web developers mark JavaScript files for immediate compilation during page load. The goal is to slash startup bottlenecks caused by parsing and compiling code on the fly.
Early tests show noticeable gains: in a sample of 20 popular websites, 17 saw improvements, with an average reduction of 630 milliseconds in foreground parse and compile times. “This is a leap forward for responsive web apps,” said a V8 engineer familiar with the project.
How Explicit Compile Hints Work
Developers add a magic comment //# allFunctionsCalledOnLoad at the top of a JavaScript file. This tells V8 to eagerly compile every function in that file during initial script processing, rather than deferring compilation until a function is actually called.
Eager compilation happens on a background thread, overlapping with network loading. “If you wait until a function is invoked, it’s too late to parallelize – the main thread stalls,” the engineer explained. The feature is best used sparingly, as overcompiling wastes memory and CPU.
Background: V8’s Compilation Challenge
When V8 processes a script from the network, it must decide for each function whether to compile it eagerly or defer. Deferred functions require a lightweight parse to find their end (JavaScript’s grammar is too complex for brace counting), and then a full parse later – duplicating work.
Eager compilation avoids that duplication and runs in the background. But without hints, V8 has to guess which functions will be needed during page load. Explicit Compile Hints remove the guesswork.
What This Means for Web Performance
For web developers, this feature provides a surgical tool to optimize critical JavaScript files – especially “core” files that contain the bulk of startup logic. “It’s like giving V8 a heads‑up,” said the engineer. “You can now control what gets compiled early without touching your build pipeline.”
The feature is shipping in Chrome 136 and is particularly useful for sites where a single file drives initial interactivity. Developers can also restructure code to create such a core file if needed. Google warns that the magic comment should be used only on files where nearly all functions are called on load.
Testing the Feature Yourself
To see compile hints in action, create two script files. In script1.js, include a function and call it without a magic comment. In script2.js, add //# allFunctionsCalledOnLoad at the top. Then run Chrome with a clean user data directory (to avoid code caching interference) and check the DevTools performance log.
Detailed logging commands are available in the V8 documentation. The team expects broader adoption as more developers experiment with the new hint.
This is a breaking development in browser performance. Explicit Compile Hints are now live in Chrome 136 – test them on your own pages to measure the impact.