Try out JIT compiler with PHP 8.0

Itchishiki Satoshi
Frontier
Published in
6 min readJan 9, 2020

--

You probably heard the news a few months ago that the JIT compiler will be added to PHP 8. If you haven’t heard, it is this poll. 90% of contributors who voted for PHP 8. Since PHP 7.0, we have been making changes to improve performance, and this is a new breakthrough. performance for PHP. This is a very big feature, it was started to develop 2 years ago, PHP 8.0 is at least more than 1 year to launch. In this article, let’s take a look at what it is and try to use it.

What is JIT

Maybe you do not know about JIT so first I will explain what it is. You probably already know that PHP is an interpreted language, meaning that your code doesn’t need to be compiled before it runs (just like C / C ++). Instead, the PHP engine will read your code and run it. In other words, you do not code to compile into machine code for the computer to run, but to code a script and give it to PHP to run.

PHP has a virtual machine called Zend VM. Why call it a virtual machine, because it acts like your computer in running the code, as explained above. It is responsible for reading and running your PHP code. But before that, your code will be read and translated by PHP into opcode, which is the language that Zend VM understands. Then Zend VM can run that opcode. This is an illustration for easy understanding.

--

--

Itchishiki Satoshi
Frontier

Just a code lover. Technical leader at Paypay Japan.