PHP 5.4 Benchmarks
Today I’m giving my first ever talk at OSCON – about PHP 5.4 (I’ll also be giving my second ever talk at OSCON, about RESTful services; it’s a busy day!). My talk includes some benchmarks which I thought I’d also share here, mostly because I like pretty graphs – and this one is pretty:
This graph shows the performance of four versions of PHP (because the bench.php
script that lives in the php source tree didn’t appear until 5.1). The axis up the left is the time it took to run the benchmark script – so a smaller number is better news.
For each run:
- I grabbed PHP source code for the newest version of each of PHP 5.1 through to PHP 5.4 (and then had to do that again 2 weeks later when we released new versions of PHP 5.3 and 5.4)
- Compiled them with their “vanilla” settings – none of these versions has any extensions added or is the PHP version I actually use
- Ran the
bench.php
script 10 times and collected the data (full table below) - Averaged the data and put it on the nice google chart
If you’re interested in the raw numbers, this is what I have:
Version | run0 | run1 | run2 | run3 | run4 | run5 | run6 | run7 | run8 | run9 | avg | |
PHP 5.1.6 | 3.985 | 4.038 | 3.912 | 3.966 | 4.006 | 3.963 | 3.973 | 3.939 | 3.969 | 3.981 | 3.9732 | |
PHP 5.2.17 | 4.28 | 4.147 | 4.005 | 4.071 | 4.116 | 4.096 | 4.054 | 4.099 | 4.077 | 4.103 | 4.1048 | |
PHP 5.3.14 | 2.786 | 2.831 | 2.762 | 2.789 | 2.761 | 2.972 | 2.825 | 2.772 | 2.749 | 2.753 | 2.8 | |
PHP 5.4.4 | 2.441 | 2.237 | 2.228 | 2.216 | 2.216 | 2.224 | 2.232 | 2.229 | 2.237 | 2.251 | 2.2511 | |
(with thanks to textfixer.com for a CSV->HTML table conversion tool)
So there you have it: PHP 5.4 is measurably faster than the previous versions of PHP 5.3 (but not twice as fast). Time to upgrade?
lower memory usage and the new features are also good reasons to upgrade (if you can). but many webhosts will not switch to 5.4 this year.
Pingback: PHP 5.4 Benchmarks | LornaJane | Luis Gomes | Scoop.it
Thanks a lot for sharing these metrics. It seems clear that upgrades to newer versions should be scheduled for all of those who use PHP.
It would be great to also measure the amount of memory allocated to run the benchmark. By the way what’s exactly the bench.php file you’re running? Is it that one http://svn.php.net/viewvc/php/php-src/trunk/Zend/bench.php?view=markup ?
yes, it’s exactly that bench.php. It doesn’t seem to spit out information about memory usage, although it does give a really comprehensive breakdown of how much time each segment of the benchmark took (I have these numbers from when I did the above benchmarks, if anyone wants them)
You should also add an infos about avg. memory footprint for each of versions.
Pingback: Programowanie w PHP » Blog Archive » Lorna Mitchell: PHP 5.4 Benchmarks
Pingback: PHP 5.4 Benchmarks | Open Source Code | Scoop.it
Did anybody care to scan the source-code of PHP and provide metrics? I mean: it’s nice to know that this runs X seconds faster on your machine than with the old version, but may not give me a good prediction for other software on other hardware. Only if you could provide the number of operations required for an average set of commands and show that there are Y percent less operations than before, this would give us a clear prediction of the average performance increase we are to expect from an upgrade on any software and any machine.
Every application is different, this is a very general picture of whether the performance is improved between PHP versions, for comparable and generic code – how much it is improved for your application, on your hardware, with your traffic patterns can only be established by testing exactly that! It’s usual for people to upgrade PHP on one webhead and observe how their monitoring output changes to get a clearer idea of the impact of the upgrade – you just can’t generalise for something so specific I’m afraid
There are some web-hosting that are using php version 5.2 and call it as a stable version :D (funny)
If they upgrade to 5.3, it would be a great job, let alone upgrading to php version 5.4 :)
Anyway, benchmark was great,
Thank you
Calling version 5.4 “stable” seems even funnier to me. ;-)
Why is that? Have you had some issues with PHP 5.4? I haven’t had that experience at all but I’d be interested to hear how it was for others
You should also express these results as a percentage improvement on previous versions.
Pingback: JQueryin | PHP 5.4 Benchmark Performance
Pingback: PHP verziók futásideje | Bejegyzések főleg az informatika területéről
Extreme performance with PHP 5.4….. Cool
Pingback: New PHP 5.4 and ASP.NET 4.5Organic Solutions Corporate Blog | Organic Solutions Corporate Blog
Pingback: Easy Wins For More Performant PHP - SitePoint
Pingback: Why I'm excited for Magento2 and you should be too | Demac Media
Pingback: In-depth Analysis of New Magento2 Development Updates
Pingback: New PHP 5.4 and ASP.NET 4.5 | The Organic Group
Pingback: PHP 5.4 - entwickler.de
What are you thoughts on PHP 7 performance. I have seen the benchmarks on Cloudways platform (https://www.cloudways.com/en/php-cloud-hosting.php ). It was tested with wordpress and the result was 37,378 hits with 0 errors and 0 timeouts. Average response time was an impressive 4ms on vanilla WordPress 4.4 with caching. I believe it is amazing and people should update to this version.
I published some benchmarks when PHP 7 was new (see http://www.lornajane.net/posts/2015/php-7-benchmarks) and agree that everyone should update – also PHP 5 is no longer supported so PHP 7 is the best option in any case.
Pingback: PHP 7 Benchmarks | LornaJane