Post

Chrome 136+ ships a new V8 version that supports a "compile hint", which makes V8 parse and compile all functions in that file eagerly. Great for entry points – where you know all functions will very likely be used. Less so as 'one weird trick to make all your JS faster'.

An easy way to figure out if this might make sense to add for you: Open Chrome DevTools -> 3 dots -> More tools -> Coverage. The files with the least amount of unused functions right after a page load, will gain the most from this.

0 reposts2 likes

The "Performance" tab of DevTools shows compilation & parsing here - important: disable caching to avoid v8's byte cache! The compile hint changes how early the compilation happens. If the main thread stalls while waiting for compilation to finish, the compile hint can have positive impact.