PHP 8 will support Just-In-Time (JIT) a compiler strategy

All along, everyone is discussing whether JIT (Just-In-Time) just-in-time compiler execution will be supported in PHP 8. The latest news is officially confirmed that PHP 8 will support Just-In-Time. PHP implements a virtual machine, Zend VM, which compiles human-readable scripts into instructions that the virtual machine understands, that is, opcodes. This execution phase is called “Compile Time.” During the “Runtime” execution phase, the virtual machine Zend VM executes these compiled opcodes.

PHP 7.3

Usually, the compile time and the runtime are separated separately. After the script is compiled, the bytecode cache components like APC and OPCache cache these opcodes. The JIT removes the compile-time phase, which combines the compile-time and runtime phases to achieve instant compilation and execution.

“Just-in-time is a compiler strategy that takes an intermediate representation of code and turns it into architecture dependent machine code at runtime – just-in-time for execution.

In PHP, this means that the JIT treats the instructions generated for the Zend VM as the intermediate representation and emits architecture dependent machine code, so that the host of your code is no longer the Zend VM, but your CPU directly.”

Although PHP performance has been significantly improved since PHP 7.0 by optimizing the core data structure HashTable, enhancing some opcodes in the Zend VM, and continuously improving OPCache’s Optimizer component, in reality, these optimizations seem to have reached the limit. Now that JIT is working from the ground up, it is considered to be the best way to improve PHP performance today.