PHP 7 Benchmarks

If you know anything at all about PHP7, you probably know it's fast. But did you know how fast? The alpha is out and looks very robust, so I decided I would create a new set of benchmarks to include it. Graphs first, disclaimers later :)

This graph shows the time it takes for each version of PHP to perform the same task, on average, with oldest PHP on the left and moving forward in time.

php-70-alpha-benchmarks

The benchmark is the Zend/bench.php that lives in the PHP sourcecode (run ten times for each version of PHP using the php7dev VM on an average laptop, and then the mean result for each version calculated). The script runs through a series of taxing algorithms, giving a sense of how quickly a series of computational instructions can be executed. So by this measure, PHP 7 is much quicker than any of the PHP 5 family. Looking at the adoption rates of PHP , many readers may well be on PHP 5.3 which is why it's included in the graph (if you're still on PHP 5.2, then you need to go back to my 5.4 benchmarks to see that in context of the other versions) - but the performance increase will be remarkable for all PHP 5 applications when they adopt the new platform. The absolute numbers here don't mean a lot but the relative performance of the various versions should hold true.

What About Real PHP Applications?

Real PHP applications will always vary but already there is a lot of data available - the best set by far is in Rasmus' slides, where he shows a selection of open source projects and measures the requests/sec that they can handle on various versions of PHP. You can find those here: http://talks.php.net/fluent15#/drupalbench (and keep arrowing right).

Basically: it's fast. So fast that all anyone can talk about is how fast it is. For a language which has seen such impressive speed improvements in the lifetime of the PHP 5 branch, this blowing me away :)

How Realistic Is It To Upgrade?

Realistic. The PHP 5 to PHP 7 platform upgrade is going to be easier than the PHP 4 to 5 upgrade was, and many applications did that successfully. I'd also say that going from PHP 5.5 or PHP 5.6 to PHP 7 is easier than going from PHP 5.2 to PHP 5.3.

To upgrade: your first step is to get to PHP 5.5 or PHP 5.6. Seriously. No PHP 7 for you unless you go there first.

What Should I Do Now?

PHP 7 isn't stable but it still absolutely needs your input, no matter who you are or what your skill level.

  • Try running your application and all its tests on PHP 7 - it's the master branch of https://github.com/php/php-src/. A really easy way to get started is to use the ready-made VM here: https://github.com/rlerdorf/php7dev.
  • If you find bugs, report them. Try to work out if it's in a library or in PHP itself, and TELL US. That's what the alpha release is for and your effort will literally change the world :)
  • Check what extensions your application uses, then make sure they are listed here https://github.com/gophp7/gophp7-ext/wiki/extensions-catalog. If not, add them. If they're not ready for PHP 7 yet, we have lots of resources to help you to compile the extension yourself and help us work out what needs doing to make sure they are ready for when you will need them.

PHP 7 is looking great, but it won't be successful without our input. Yes, the benchmarks are impressive, but if you're still reading, thankyou. The input of the community to do simple, non-scary-internal-C-code things, just to run code and verify what does and doesn't work, will make the difference between a smoother, sooner launch, and a disaster. Let's get to it.

6 thoughts on “PHP 7 Benchmarks

  1. Pingback: PHP 7 Beta 1 - entwickler.de

  2. Pingback: PHP Annotated Monthly – July 2015 | JetBrains PhpStorm Blog

  3. Pingback: Probably The Best Website Optimisation Work-Through Post I’ve Read … – Technical Stuff By A Non Technical Bloke

Leave a Reply

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