v136 · javascript

Explicit Compile Hints with Magic Comments

Allow attaching information about which functions should be eager parsed & compiled in JavaScript files.

concepts

  1. 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.

  2. 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 //# allFunctionsCalledOnLoad magic comment.

  3. Hint Inspector

    Inspector view: parses a bundle, lists every detected function, flags per-function %CompileBaseline tags, and reports eager-compile coverage with a verdict on whether the file is well-annotated.

  4. 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.

references