TurboFan
V8's optimising compiler, which turns hot functions into fast machine code based on the types it has seen.
In more detail
TurboFan assumes values will keep the types recorded so far and adds cheap checks for that. If a check fails, the optimised code is thrown away and the function goes back to bytecode, which is called deoptimization.
Related terms
- V8 — Google's open-source JavaScript engine, used by Chrome and Node.js to parse, compile and run JavaScript.
- speculative optimization — Compiling code on the bet that values will keep the types seen so far, with checks that fall back to slower code if the bet fails.
- deoptimization — When a just-in-time compiler throws away optimised machine code because the assumptions it was built on no longer hold, and falls back to slower code.
- hidden class — An internal record V8 keeps of an object's property names and their order, so it can find properties quickly.
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