just-in-time compilation
Compiling code into machine code while the program is already running, focusing on the parts that run most often.
In more detail
An interpreter starts running code instantly but runs it slowly, while compiling everything ahead of time needs a separate build step. A JIT compiler combines both: it starts by interpreting, watches which functions are hot, then compiles those into optimised machine code. V8's pipeline runs Ignition, then Sparkplug, then TurboFan.
Related terms
- Ignition — V8's interpreter, which turns the abstract syntax tree into bytecode and runs it so code starts quickly.
- Sparkplug — V8's fast non-optimising compiler, which turns bytecode directly into simple machine code for functions that run often.
- TurboFan — V8's optimising compiler, which turns hot functions into fast machine code based on the types it has seen.
- hot path — Code that runs very often, such as on every request, where small costs add up.
Taught in
- V8 Engine & JIT Pipeline: Bytecode & Turbofan — Node.js Internals & Backend Services
- Node.js Process Architecture: Memory & Heap Spaces — Node.js Internals & Backend Services