What is PHP's Just-In-Time (JIT) compiler?
Answer
The JIT (Just-In-Time) compiler, introduced in PHP 8.0, compiles parts of PHP code to native machine code at runtime, bypassing the bytecode interpretation step for hot code paths. Before JIT, PHP executed by having the Zend Engine interpret opcodes (precompiled bytecode cached by OPcache). JIT sits on top of OPcache and further compiles frequently-executed opcodes to machine code. JIT provides the most significant speedup for CPU-intensive tasks (math operations, algorithms) but provides minimal improvement for typical web requests (which are I/O-bound). Enable in php.ini: opcache.jit=tracing and opcache.jit_buffer_size=100M. For web applications, the practical improvement is typically 5-15%; for scientific computation, it can be much higher.
Previous
What is the difference between method chaining and fluent interface?
Next
What is OPcache in PHP?