v136 · javascript
Explicit Compile Hints with Magic Comments
Allow attaching information about which functions should be eager parsed & compiled in JavaScript files.
concepts
-
Compile Hints
Magic-comment hints tell V8 to eagerly compile a file or function. Useful for libraries with critical-path code that benefits from skipping the lazy-compile step.
-
Critical bundle annotator
The build-tool angle: paste a library, the tool counts declared functions vs. ones called on load and decides whether to prepend the
//# allFunctionsCalledOnLoadmagic comment. -
Hint Inspector
Inspector view: parses a bundle, lists every detected function, flags per-function
%CompileBaselinetags, and reports eager-compile coverage with a verdict on whether the file is well-annotated. -
Startup timer
Benchmark: generates a module with N functions, imports it as a Blob URL with and without
//# allFunctionsCalledOnLoad, and times the first call. Shows when eager compilation pays off and how module size affects the tradeoff.
why it shipped
Allow attaching information about which functions should be eager parsed & compiled in JavaScript files.