How to enable JIT on PHP 8.0?

The default installation of php 8.0 I mentioned in the previous post has JIT built-it. But, here is a big BUT, JIT is not enabled.

I used the testing script which is found in this post. The source code can be downloaded at Github. I put a local copy for reference.

Download Bubble.php zip file

I run this php scrip, or bubble.php, at the default settings of PHP 8.0.1.  About 10 runs, I got the average time is 0.095 seconds.

 

Then I try to config the php-fpm to make JIT work.

Edit /etc/php/8.0/fpm/php.ini

opcache.enable =1
opcache.jit_buffer_siez = 100M
opcache.jit = 1255

Restart the php8.0-fpm service.

Later I re-run the bubble.php script 10 times. The average time is 0.053 seconds.

As a comparison, php 8.0 JIT vs no-JIT is about 45% faster.

I tested the bubble.php on PHP 7.4.14, as well.

The average time is 0.121 seconds.

It worths upgrading the php-fpm service from 7.4 to 8.0 now if I can solve all the compatible issues. And I will enable JIT, because JIT brings the most improvement of performance.

Leave a Reply

Your email address will not be published. Required fields are marked *