A function’s performance can change dramatically without changing its source: V8 compiles code in stages, investing more work in functions that run repeatedly. The pipeline moves from lazy parsing to bytecode, baseline machine code, and finally highly optimized machine code. section 6.6.2
The pipeline responds to execution frequency and observed types:
- Lazy parsing pre-parses a function for syntax, then builds its full syntax tree only when the function is called. section 6.6.2
- Ignition compiles every parsed function into bytecode, a simplified instruction set for execution. section 6.6.2
- Sparkplug and Maglev provide baseline machine-code compilation, while TurboFan produces highly optimized machine code. section 6.6.2
- Feedback slots record type information for instructions; changing argument types can invalidate that feedback and require new instructions. section 6.6.2
Why repeated calls get faster
For getTotal(items), measurements over 20 million element reads improve from 986.12 milliseconds under Ignition to 25.38 milliseconds under TurboFan. Each tier changes the execution cost rather than the function’s source behavior. section 6.6.2
Figure 6.1 The V8 Compilation Pipeline

The pipeline diagram makes the progression from parsing through optimized machine code immediately navigable. section 6.6.2







