JIT Compiler Introduction (PHP 8.0)
debt(d9/e3/b3/t7)
Closest to 'silent in production until users hit it' (d9). The detection_hints indicate automated detection is 'no' and the only hint is the presence of opcache.jit in config. There is no tool that flags whether JIT is configured inappropriately for your workload — the misconfiguration (enabling JIT expecting speedup on I/O-bound apps) produces no warnings and is only revealed by profiling under real production load.
Closest to 'simple parameterised fix' (e3). The quick_fix is a small config change — set opcache.jit=tracing and jit_buffer_size=128M, then profile. Correcting a mistaken JIT deployment means tweaking php.ini settings and running benchmarks, which is localised work in one config file with some profiling effort, making it slightly more than a single-line patch but well within one component.
Closest to 'localised tax' (b3). JIT configuration lives in php.ini / opcache settings and applies to web and cli contexts, but it doesn't reshape application code. Developers need awareness of the config and its limitations, but the burden is confined to ops/config rather than permeating application logic or architecture.
Closest to 'serious trap' (t7). The misconception field states explicitly: 'JIT makes all PHP apps 3x faster — it's transformative for CPU-bound tasks but barely noticeable for I/O-bound web apps where DB queries dominate execution time.' This directly contradicts a competent developer's reasonable expectation when they hear 'JIT compiler' from other ecosystems (e.g. Java, .NET JIT) where the benefit is broadly felt. The common mistakes reinforce this: enabling JIT expecting dramatic web app speedup is a well-documented but frequently repeated mistake.
TL;DR
Explanation
PHP 8.0 added two JIT modes in OPcache: tracing JIT (best for web) and function JIT. Configure: opcache.jit=tracing, opcache.jit_buffer_size=128M. JIT works on top of OPcache — both must be enabled. Real-world gains: minimal for I/O-bound web apps (DB queries, file reads dominate). Significant for: pure computation (image processing, math, ML inference, 3D rendering, game servers). PHP benchmarks show 3–8x speedup for pure PHP CPU tasks. For typical Laravel/Symfony apps: 0–5% improvement. JIT is most useful for CLI PHP applications doing heavy computation.
Common Misconception
Why It Matters
Common Mistakes
- Enabling JIT expecting dramatic web app speedup — profile first.
- Setting jit_buffer_size too small — JIT falls back to interpretation.
- Not profiling to confirm JIT helps your specific workload.
Code Examples
# php.ini — enabled everywhere without profiling:
opcache.jit=tracing
opcache.jit_buffer_size=8M # Too small
# Production with JIT for CPU-bound PHP:
opcache.enable=1
opcache.jit=tracing
opcache.jit_buffer_size=128M
# Verify JIT is active:
var_dump(opcache_get_status()['jit']);