Join us

PHP 5.6 - 8.1 Benchmark with JIT included

Photo by Ben Griffiths on Unsplash

This simple benchmark will guide you in deciding on the perfect setup and configuration for your application.

PHP has made some huge progress in the past couple of years with the release of 8.0 and 8.1 and their new features like named parameters , constructor promotion , match expression , union return types , readonly properties , enums , just to name a few.

The most important one in my opinion related to performance is JIT. I’ve been fascinated by this feature and how much it helps in the long run when dealing with some applications which require lots of resources and time to return a response.

That’s why I decided to do a performance benchmark to really understand the benefits in execution time by using one of the slowest and with time complexity of O(n²) sorting algorithms like BubbleSort to sort an array with 10000 numbers.

I was fascinated by the results and the table alongside with the chart below will show you why.

Table: Execution time per version in seconds

Chart: Execution time per version in seconds

As it’s shown, from PHP 5.6 to PH 7.4 the difference is really big. Things don’t change that much from PHP 7.4 to PHP 8.0, around 0.3s. The same thing goes for PHP 8.0 compared to PHP 8.1, the difference is only ~0.06s.

Things take a different turn when JIT is enabled, as it’s shown in the table and chart above. The difference in PHP 8.0 with and without JIT is around 2.65s, which is quite huge. The same thing goes for PHP 8.1 where the difference is almost the same as PHP 8.0.

JIT in itself converts the PHP code to machine code and that’s how it enables a faster execution. It can be enabled very simply by tweaking a bit the php.ini config file and adding the following lines:

This benchmark can be found on GitHub with a docker setup in the following link:

I hope that this simple benchmark guides you in deciding on the perfect setup and configuration for your application.

Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!


Albion Bame

Staff Software Engineer, Emma - The Sleep Company

Howdy, I’m Albion, I’m a web developer living in Frankfurt am Main, Germany, originally from Albania, fan of DIY, cycling, and camping. I’m also interested in travel and reading.
User Popularity



Total Hits