demo · v132

Compile Hints — eager vs lazy

Pick a magic comment and a function size. The page fetches a generated JS file from a data: URL and times how long it took the engine to parse and start. Eager hints accept the parse cost up front; lazy keeps it deferred.

generated source (top)

script load + execute time

ms

click Run to time the script

how the hint works

//# eagerCompilation=all
function frequentlyCalled() { /* … */ }
// V8 sees the magic comment and compiles the whole file eagerly, so the first call has no cold-start penalty.

see also