Why does V8's two-tier system matter for Node.js?
It explains why Node.js is fast: quick startup with Ignition, then optimization with TurboFan for hot code. It also explains why type-stable code (consistent types) optimizes better in V8, since the profiling feedback is consistent.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How V8 Compiles JavaScript to Machine Code in Node.js
V8 parses JavaScript to an AST, compiles the AST to bytecode for the Ignition interpreter (fast startup), profiles hot code, then the TurboFan optimizing compiler generates optimized machine code for hot code. Deoptimization handles cases where assumptions break.
V8's interpreter. It compiles the AST to bytecode and executes it. Ignition starts fast, so your code runs quickly even before optimization. The interpreter also collects profiling data that drives TurboFan optimization.
V8's optimizing compiler. For hot code, TurboFan takes bytecode and profiling feedback and generates highly optimized machine code, much faster than interpreted bytecode. This is why hot code runs at near-native speed in V8.
Still have questions?
Browse all our FAQs or reach out to our support team
