PHP 5.6 Benchmarks

A while ago I did some benchmarks on how different versions of PHP perform in comparison to one another. This isn’t a performance measure in absolute terms, this was just benchmarking them all on the same laptop while it wasn’t doing anything else, and averaging the time it took to run the benchmark script.

Recently I ran it again for versions PHP 5.3 through PHP 5.6 and I thought I’d share my results:

php-performance-may-2014

PHP’s performance has consistently improved over the versions; here I don’t show versions earlier than PHP 5.3 but that version was also much faster than earlier releases of PHP 5. I meet many applications whose PHP platform aren’t upgraded because they don’t need the new features in the new versions. This is absolutely fine, but what application wouldn’t benefit from improved performance and security?

The individual numbers, if you should want them:

version run 1 run 2 run 3 run 4 run 5 run 6 run 7 run 8 run 9 run 10 average
5.3.28 4.141 3.916 3.365 4.355 3.302 3.513 3.53 4.585 3.653 4.786 3.9146
5.4.27 2.791 2.44 2.943 2.486 2.511 2.617 2.456 2.649 3.01 3.332 2.7235
5.5.11 2.228 2.615 2.346 2.851 2.504 2.475 2.489 2.606 3.429 3.313 2.6856
5.6.0beta2 2.057 2.202 2.149 2.233 2.228 2.247 2.641 2.572 2.283 2.958 2.357

I’m hearing some very convincing rumours about big performance improvements on the horizon for future versions PHP, and that is fantastic, but even the currently-released (or almost – 5.6 will be stable in the coming months) versions have a lot to offer PHP developers everywhere. If any paid-for platform offered this kind of improvement for free, it would be big news. Maybe we should start to shout about some of the good news in PHP too?

12 thoughts on “PHP 5.6 Benchmarks

    • Ah, I didn’t outline this very well in my post. I simply took a download of each version, and ran:

      • ./configure
      • make
      • /path/to/new/php/sapi/cli/php /path/to/new/php/Zend/bench.php

      The final step was run 11 times so that I could ignore the first run and capture 10 attempts to average over. It’s pretty unscientific but I hope it gives an idea of the relative performance capabilities of each version.

  1. Interesting results.

    I’m quite excited to see what php-ng will bring. I’ve had a hobby project that hammered PHP on performance, even making me wonder if I shouldn’t rewrite it in say python or java or whatever, but I gave hhvm a whirl and was literally blown away by the performance gain. Granted this performance bottleneck was a whole load of php logic, basically a tight loop running over millions of rows and keeping track of various lists. so really something that php is known to be bad at.

    I can’t wait to see how php-ng will perform.

    Although I also want to look at Hack, the strong typing really appeals to me. Especially for writing robust services where you just want to be explicit all the time.

    Either way I’m really liking the direction PHP is going in.

  2. Thanks for sharing this information!
    Indeed, PHP seems to be heading in the right way. The performance issues of PHP is less and less going to be an excuse not to use it. Can’t wait for PHP 6 ;)

  3. Very useful for helping site owners understand the importance of upgrading. Unless of course they have old unmaintained code/plugins. Even then, the extra effort to achieve compatibility with latest PHP versions would still be worth it. Did you have any opcode caching enabled/disabled on all versions? For example does Zend Opcache improve speeds by the same ratio across all versions? Thanks for taking the time on this.

  4. PHP 5.6 is out and I’m scouring the web to see if I should make the leap on my development machine. I thin I will now that it’s considered stable. I won’t expect that it will be available to my production machines for many months, though. Possibly a year at the rate that some of them update their respective repositories.

    • Certainly 5.6 is stable enough to use but I usually recommend that development platforms are kept at the same version as the production ones

  5. Pingback: How to Choose PHP Hosting | LornaJane

  6. Pingback: 4 things that happened in PHP while you weren't looking - O'Reilly Radar

  7. Pingback: Essential Macro Optimizations to Improve PHP Performance – Tideways

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.