PHP 7.0 Is Showing Very Promising Performance Over PHP 5, Closing Gap With HHVM
Written by Michael Larabel in Software on 5 September 2015. Page 1 of 3. 11 Comments

With PHP 7.0 RC2 having just been released, I've been testing it out thoroughly across a range of Linux systems at Phoronix. To the say the least, the performance claims made by PHP developers about the upcoming PHP7 release are very accurate: it's pretty darn fast and about twice as fast as PHP 5.6. Here are some benchmarks I did on Ubuntu Linux x86_64 comparing the performance of PHP 7.0 RC2 to PHP 5.3/5.4/5.5/5.6, along with some HHVM results tossed in at the end.

PHP 7 in many cases has been advertised as being "2x faster" than PHP5 due to the significant strides made on "PHPNG" experimental code branch. PHP 7's Zend Engine has been significantly refactored while retaining compatibility with PHP 5's language syntax. Zend Engine 3 utilizes an AST-based compilation process, but still isn't a JIT compiler like HHVM. Optimizations to internal data structures should not only yield better performance results but greater memory savings too.

On the language side, PHP 7 will allow for declaring return types, scaler type hints, a combined comparison operator, a null coalescing operator, and other features.

There's many benchmarks out there already showing that for Apache and other popular web frameworks and content management systems there is indeed great performance gains up to around 2x for PHP 7 compared to PHP 5. In developing PHPNG/PHP7, the developers were reportedly using WordPress performance as their benchmark for gauging performance.

The PHP benchmarks I've been doing, of course, have been of the Phoronix Test Suite itself. Given that I don't think PHP (or HHVM) developers have been testing their PHP performance against PTS, it should be for some interesting untested grounds. Additionally, the benchmark is run from the command-line outside of any web-server or caching mechanisms. The benchmark represents not just the hot-paths of the phoronix-test-suite portable, cross-platform utility but also the hot code paths used by for all of its functionality as well as Phoromatic plus independent deployments of this open-source benchmarking framework in forms like for result parsing / graph generation.

From an Ubuntu 15.04 x86_64 system with the GCC 4.9.2 compiler, I built PHP 5.3.29, PHP 5.4.44, PHP 5.5.29, PHP 5.6.18, and PHP 7.0.0 RC2 as the latest versions of the major PHP release series. The Phoronix Test Suite does have compatibility going back to PHP 5.2, but the PHP 5.2.17 release wasn't able to build successfully with GCC 4.9.2 on this system. Due to enterprise support and EL6, etc, Phoronix Test Suite code is written for PHP 5.3 and doesn't make use of any newer language features beyond that at this time nor any checks for features above PHP 5.3. In building all of the PHP releases on this system, they were configured with just "--enable-xml --enable-json --enable-zip" as the only requirements to get it running from the command-line. The Phoronix Test Suite 6.0-M1 Hammerfest 65b09adf6e revision was the version used for all of this PHP Linux benchmarking.

With this self-hosting test profile, just like other Phoronix Test Suite benchmark results, all tests were run a minimum of three times and the average reported while also displaying any deviation in the results, etc. On the following pages are the Phoronix Test Suite benchmarks for PHP 5.3/5.4/5.5/5.6/7.0-RC2. Following them are also HHVM 5.6.99 benchmarks using Facebook's package archive for Ubuntu 15.04 on the same system.

Related Articles
Trending Linux News