JIT (Just-In-Time) compilation is a technique where code is converted into machine language at runtime instead of being purely interpreted or precompiled. In PHP, this means the Zend Engine (PHP’s core runtime) can translate PHP opcodes (intermediate code) into native machine code just before execution. As a result, PHP can run certain workloads much faster, particularly CPU-intensive tasks.
Before JIT, PHP mainly relied on interpretation or precompilation through OPcache. While efficient for most web applications, it had limitations with compute-heavy operations. JIT overcomes this by boosting performance and allowing PHP to compete with traditionally faster languages like C++ or Java in specific scenarios.

How Does JIT Work in PHP?
PHP’s JIT implementation works alongside OPcache, the built-in caching system that stores precompiled script bytecode. The process works like this in simple terms:
- Code Parsing and Compilation: When a PHP script is executed, it is first parsed and compiled into opcodes (intermediate code).
- OPcache Storage: These opcodes are stored in OPcache to avoid recompilation on subsequent requests.
- JIT Compilation: For hot paths (frequently executed code), the JIT compiler translates opcodes into highly optimized machine code.
- Execution: The native machine code is executed directly by the CPU, resulting in faster performance.
The JIT compiler in PHP uses DynASM (Dynamic Assembler) to generate machine code at runtime. It also employs various optimization techniques, such as inlining and loop unrolling, to maximize performance.
Simplified JIT Configuration Defaults
PHP 8.4 introduces a clearer and more intuitive way to enable or disable JIT:
- Before PHP 8.4:
opcache.jit = tracing
opcache.jit_buffer_size = 0
Enabling JIT required setting a buffer size—a somewhat confusing approach.
Starting in PHP 8.4:
opcache.jit = disable
(default)opcache.jit_buffer_size = 64M
(default)
To enable JIT, you now explicitly set:
php.ini
opcache.jit = tracing
opcache.jit_buffer_size = 64M
New JIT Engine Based on an IR Framework
PHP 8.4 introduces a redesigned JIT implementation grounded in a Unified Intermediate Representation (IR) framework:
- It replaces the older architecture with a cleaner, more adaptable IR-based approach.
- This structural change enables:
- Smarter optimizations
- Better register allocation
- What some describe as more maintainable core architecture
Summary Table
Feature | What’s New in PHP 8.4 |
---|---|
JIT Configuration | Now disabled by default (opcache.jit=disable ), buffer size defaults to 64M ; must explicitly enable with opcache.jit=tracing |
JIT Engine | Rewritten using an IR framework for smarter, unified compilation |
Performance | Modest speed gains (5–10%), reduced code size, and better memory usage |
Portability & Maintainability | Easier to support new architectures and maintain JIT subsystem |
Real-world Impact | Most beneficial for long-running processes; gains may be minimal for typical request-response web workflows |