PHP 8 Release Candidate Performance
Since a year ago, I have been following up on the progress of the new PHP 8. With the release of the first release candidate, it becomes the moment for checking back on the performance's progress. Unless a huge bug is discovered, I assume that there will not be relevant changes in the new PHP version's core.
Please note that the this still is not the final version of PHP.
Don’t use it yet in any production deployment.
For keeping consistency with my previous tests, I will reuse the same code that I employed before (well, also because it is a fun excuse for using a bubble sort). You can find the source code here.
First, let’s run it without JIT:
docker container run --rm -v $(pwd):/script/ php:8.0.0rc1 php /script/bubble.php
The average time after 100 runs is 0.058 seconds, what it is not bad.
Now, we will run it with JIT activated. Because I couldn’t find a docker image already done with the PHP 8 release candidate and JIT activated, I have created my own one.
docker container run --rm -v $(pwd):/script/ pedroescudero/php8jit php /script/bubble.php
After the 100 runs, the average time is 0.029 seconds. Less than half! This is really impressive. Of course, for having a deeper understanding of the performance of the release candidate with JIT activated, we will need to apply it to more complicated algorithms and test it in more real-life/production-like environments. Still, at first glance, I think that this test pours pretty good numbers.
Let’s have some perspective and take a look also at an old version coming from 2009:
docker container run --rm -v $(pwd):/script/ php:5.3 php /script/bubble.php
It took an average of 0.63 seconds. An Eternity.
If you are interested in creating your own image, recommend visiting both the blog of Arkadius Kondas and the Docker readme of Keinos. I’ve based my image on the previous work from them, but while their versions don’t have the first release candidate, I was forced to get my hands dirty and built my own PHP 8 docker image with JIT activated.