About six years ago, I was at a point where I nearly gave up on PHP. For fun, I solved Project Euler puzzles, and PHP (at that time, I was using a 32-bit version on top of it) was excruciatingly slow when solving these puzzles. Fast-forward to 2020: I had the puzzles I solved back then lying around on Github. As those consist mainly of math, nothing changed functionality wise - but they are a perfect starting point to see how PHP Performance changed over time.
In 2014, I already implemented a
microtime-based timer to get performance measurements. PHPUnit test cases trigger the execution of the code. For each test round, I did a
composer update to get a setup matching the used PHP version. The PHP versions are all installed directly on WSL2 Ubuntu 20 via the Ondrej PPA.
The test code
You can take a look at the test code (or try it yourself) at https://github.com/susannemoog/proj-euler - but please keep in mind the bulk of that code is 6 years old :-D
Results - Table View
Results show only the results with the greatest difference for brevity - the total time however is the complete run time of all tests.
|TEST (Time in ms)||PHP 5.6||PHP 7.0||PHP 7.1||PHP 7.2||PHP 7.3||PHP 7.4||PHP 8.0RC3|
|Total Run Time||28.76s||14.92s||13.47s||13.43s||12.62s||10.78s||8.77s|
Results - Graph
As you can see, the performance improvements happening over time are impressive and continuous; so today, I would probably have no problems solving the puzzles. Of course, it always depends a bit on your use case, but chances are good you'll profit at least a bit from every upgrade. If you are still stuck on an older PHP version and needed (another) argument to upgrade - here you go. ;)