HHVM testing results are in

Last december we gave you a small update about the current state of HHVM. We finally build some good packages for RHEL 7, so it was time for some real tests. We’ve tested both the php-benchmark.com script and the performance of a stock Magento.

General

These benchmarks are in no way a comprehensive speed comparison between PHP and HHVM. It’s just to give you a basic impression of the performance differences. All the tests were conducted on a HPW server with 1 core and 4 GB memory and further:

  • The values we used were the average values of running each test 15 times
  • Using NGINX fastcgi for PHP-FPM and HHVM

At this time we did not had a proper PHP 5.6 build so 5.6 is not included in this benchmark.

Test: php-benchmark-script.com

From the website:

This free PHP performance benchmark script is a free PHP script to calculate benchmark speeds (PHP execution times) of PHP web hosting servers. The free PHP script performs some simple mathematics and string manipulating functions repetitively, and records the PHP code execution time it takes to complete the PHP functions.

To be honest we did not expected a lot of differences between PHP and HHVM on this benchmark. But it turns out that HHVM wins with big numbers on this one.

Test: php-benchmark-script.com

Test: Default Magento site

There are a lot of ways to benchmark Magento. We have chosen to test the webpage generation time and the average memory usage that was needed for generating the webpage. We first warmed up the caches for Zend OPCache (needs 1 or 2 runs) and HHVM (needs 8 runs) before we started the tests. We also disabled (don’t do this on production!) the Magento cache because we wanted to stress-test it to its maximum. Additional information:

  • Clean Magento Community Edition v1.9.0 install
  • No MySQL tweaks
  • Memory calculated by using memory_get_usage function

Test: Default Magento site - Page generation Test: Default Magento site - Memory usage


Conclusion:

The results did not really surprised us. HHVM was the overall winner.

On the first test the differences between PHP 5.4.36 and PHP 5.5.19 were marginal, but PHP 5.4.36 was just a little bit faster. Some people would expect that the CLI version would be faster, however PHP-FPM is making the difference here. PHP needs a total of 4 seconds to finish all four tests. HHVM only needs 1 second to finish all the tests. That’s 4 times faster!

When we look at the Magento page generation results there is no doubt either: HHVM runs circles around PHP! PHP 5.4.36 and PHP 5.5.19 are giving similar results. Using the Zend OPCache will give you a 30% boost and reduce the memory usage drastically. Though HHVM is 12 times faster compared to PHP and 9 times faster then Zend OPCache!

Will PHP be obsolete? We don’t think so! The eco system for PHP is big and it will keep it’s use for certain tasks. Also PHP.NET is working on PHP-NG (v7) which might change the numbers in the future.

We will continue to put efforts in getting HHVM running on our HPW platform on the same level as good old PHP. We even might do some real-world testing with some of our customers.