Just-In-Time Compilation
JIT compiles hot code to machine code at runtime, combining the flexibility of an interpreter with the performance of a compiler.
Purpose
Optimize interpreted execution at runtime, adaptively optimizing hot spots.
Mechanism
Interprets first while collecting profiling data. Hot methods/loops trigger JIT compilation to machine code. V8 TurboFan, PyPy, and HotSpot JVM use JIT. Deoptimization falls back to the interpreter when assumptions break.
Use cases
- Language runtimes
- Performance optimization
- Adaptive compilation