Next-Generation PHP 7.0 Is Running Well But Will It Catch Up To HHVM?
The next major release of PHP is to be called PHP7 in order to avoid confusion with the now-defunct PHP6 unicode initiative. PHP 7.0 is likely to be released by the end of 2015 per the PHP7 timeline. If the release candidates begin on time starting in June, we could be looking at the official PHP 7.0 release around October of this year. However, it's largely dependent upon the state of affairs at that point with the quality of the code.
The biggest feature of PHP 7 is the performance improvements due to major work on its Zend Engine, which will be Zend Engine 3 with PHP 7. Thanks to the competition from Facebook's HHVM, PHP.net has needed to step up their speed game big time, which they're managing to achieve with PHP 7.0.
Atop an Ubuntu 14.10 installation with Core i7 5960X Haswell-E processor, I was running some tests of PHP 7.0 mainline Git as of today compared to PHP 5.5 as packaged on Ubuntu 14.10, a built-from-source PHP 5.6.4, and HHVM 3.6.99. The tests were obviously with Phoromatic and the Phoronix Test Suite.
I don't have any huge and exciting PHP benchmark comparison to share today as will hold off until PHP 7.0 is actually closer to being released, but did run some basic phoronix-test-suite debug-self-test runs on each PHP release to see how the timings are. This Phoronix Test Suite sub-command just stresses a lot of the hot paths for the Phoronix Test Suite. Most of the work comes down to file operations, tons of math, XML parsing, and just other common PHP code all run from the phoronix-test-suite, a PHP CLI application run without a web server.
I was running the Phoronix Test Suite performance self-test on v5.4.1-Lipki. First up were the numbers with Ubuntu Utopic's 5.5.12 package:
PHP: 5.5.12-2ubuntu4.1 DETAILED_SYSTEM_INFO: 0.151 seconds LIST_AVAILABLE_TESTS: 0.478 seconds LIST_AVAILABLE_SUITES: 25.188 seconds INFO: 0.009 seconds CLONE_OPENBENCHMARKING_RESULT: 46.081 seconds RESULT_FILE_TO_TEXT: 4.947 seconds DIAGNOSTICS: 0.014 seconds DUMP_POSSIBLE_OPTIONS: 0.001 seconds ELAPSED TIME: 230.607 seconds PEAK MEMORY USAGE: 35.75 MB PEAK MEMORY USAGE (emalloc): 34.213 MBThe test took 230.6 seconds with peak memory usage at around 35MB. Next up was PHP 5.6.4 built from source.
PHP: 5.6.4 DETAILED_SYSTEM_INFO: 0.147 seconds LIST_AVAILABLE_TESTS: 0.347 seconds LIST_AVAILABLE_SUITES: 18.021 seconds INFO: 0.007 seconds CLONE_OPENBENCHMARKING_RESULT: 38.398 seconds RESULT_FILE_TO_TEXT: 4.660 seconds DIAGNOSTICS: 0.014 seconds DUMP_POSSIBLE_OPTIONS: 0.001 seconds ELAPSED TIME: 184.783 seconds PEAK MEMORY USAGE: 35.75 MB PEAK MEMORY USAGE (emalloc): 34.206 MBPHP 5.6 was much faster with taking just 184 seconds in comparison to PHP 5.5's 230 seconds. The peak memory usage was around the same at 35MB for the self-test. Next is the look at PHP mainline Git as of this morning and built in the same manner as PHP 5.6.4.
PHP: 7.0.0-dev DETAILED_SYSTEM_INFO: 0.138 seconds LIST_AVAILABLE_TESTS: 0.252 seconds LIST_AVAILABLE_SUITES: 12.408 seconds INFO: 0.005 seconds CLONE_OPENBENCHMARKING_RESULT: 37.730 seconds RESULT_FILE_TO_TEXT: 4.401 seconds DIAGNOSTICS: 0.011 seconds DUMP_POSSIBLE_OPTIONS: 0.003 seconds ELAPSED TIME: 164.844 seconds PEAK MEMORY USAGE: 30.879 MB PEAK MEMORY USAGE (emalloc): 23.944 MBWith PHP 7.0 Git in its current development form, the self-test time drops another 20 seconds down to 164 seconds... Or around 30% compared to PHP 5.5 on Ubuntu 14.10. The peak memory usage is also measurably lower.
However, if looking at HHVM 5.6.99, the PHP 7.0 state for this particular test run doesn't look as appealing:
PHP: 5.6.99-hhvm DETAILED_SYSTEM_INFO: 0.336 seconds LIST_AVAILABLE_TESTS: 0.251 seconds LIST_AVAILABLE_SUITES: 13.059 seconds INFO: 0.033 seconds CLONE_OPENBENCHMARKING_RESULT: 14.521 seconds RESULT_FILE_TO_TEXT: 0.014 seconds DIAGNOSTICS: 0.033 seconds DUMP_POSSIBLE_OPTIONS: 0.004 seconds ELAPSED TIME: 84.759 seconds PEAK MEMORY USAGE: 134.844 MB PEAK MEMORY USAGE (emalloc): 14 MBHHVM on the same Ubuntu Linux system was running the self-test in about half the time of PHP 7.0 Git. With a big difference in the clone OpenBenchmarking.org micro-test, it looks like HHVM's networking support might be running a heck of a lot faster than PHP, to at least partially explain some of the speed difference.
PHP 7.0 is making many improvements to its engine for greater performance, but it seems at least for this isolated test that Facebook's HipHop Virtual Machine is still dominating. Aside from the performance, PHP 7.0-devel Git was running well on the system with the few hours I've been using it to verify no issues against the newest Phoronix Test Suite / OpenBenchmarking.org / Phoromatic code.
Again, I'll be back with many more thorough PHP benchmarks and PHP 7.0 news as its release nears -- hopefully by the end of 2015! In the mean time, share your PHP 7 hopes and thoughts by commenting on this article.