What is HHVM?
In case you have not heard about it till now, let me tell you a few things about it in brief, before we go into the HHVM vs PHP 7 tests
HHVM is an abbreviation for HipHop Virtual Machine. It was created by Facebook in 2010, with the first public version released in 2011. The main reason behind its creation was to save the server resources and to provide a faster web experience. It does so with the help of a Just in Time (JIT) compiler, which takes PHP code and complies it into Machine code on the fly.
Advantages of HHVM
- Performance boost: one of the major advantages that HHVM brings to the table is a considerable performance boost, thanks mainly due to the JIT compiler.
- Facebook: What makes the HHVM community and support great and dependable is the fact it is being backed by Facebook. As Facebook uses HHVM itself as well, it works hard to optimize it as much as it can.
- Hack: The ability to statically code, using HHVM internally developer language hack further increases the speed of compilation.
Disadvantages of HHVM
- Custom extensions: You can add out-of-the-box custom extensions. You will have to convert the extensions for HHVM first before adding them
- Facebook: Yes this is one of the advantages of HHVM, but what if Facebook decides not to go back to it one fine day? This would mean that HHVM would lose the great Development and Support community that they have.
- WordPress Plugins and Themes: Another big disadvantage for HHVm is that it does not support all the WordPress plugins and themes out of the box. You might have to hack some of them to work properly with HHVM.
- Supports high-end machines: HHVM is not supported for any 32-bit machines. Along with this HHVM also takes a lot of memory as compared to PHP 7 which puts constraints on the server selection. HHVM, ideally does not work well with smaller servers (<2 GB ram).
Let’s get down to the performance test between HHVM and PHP 7
HHVM vs PHP 7
Test site details
- The latest available WordPress version at the time when the article was written was WordPress 4.4.2
- 1000 blog posts on the site
- TwentySixteen default theme
- 150 users
- Around 500 comments
- Hosted on an Ubuntu 14.04 server
- With 1GB Ram
- 20GB SSD Disk
- Running Nginx (No caching)
- Dedicated VPS Hosting
TEST 1: Loadstorm test
We tested the same WordPress site for HHVM and PHP 7 on the same server on the load Performance benchmark test at loadstorm.com. The test was conducted for upto 10 concurrent users for a duration of 10 minutes.
Comparing the two tests, we can see that even though HHVM was slow to start off with and got a huge spike in the response time, after the first minute or so it caught up and even made ground to PHP 7 as it emerged the clear winner in this test.
We can see that the average response time for HHVM is far less than that for PHP 7, even with having such a high Peak Response Time. Its performance during the initial part of the test was slow due to the fact that it caches the pages initially which can cause a temporary performance drop, but after that the performance picks up incredibly.
TEST 2 : WebPageSpeed test
This is a simple web page speed test loading test performed at http://www.webpagetest.org/
In this test, both PHP 7 and HHVM sites fared almost equally, with the latter’s site loading slightly faster than the PHP 7 WordPress site.
TEST 3: WP Performance Tester Plugin
For the third and final test, we used the “WP Performance Tester” plugin, which is a Performance benchmark testing WordPress plugin
In this test we found that the PHP 7 WordPress site had the edge and performed better, as we can see from the total Execution time taken by the PHP 7 site was less than than that for the HHVM site and it also executed more queries per second.
From our tests, we found that though PHP 7 has caught up a lot against HHVM, from PHP 5.6, the HHVM WordPress site still performed better for a high number of concurrent requests on the server. This is because it takes less CPU resources and thus gives a better response time than PHP 7.
That being said PHP 7’s performance was almost at the same level as HHVM for the Site load time test. PHP 7 also performed better in terms of the number of queries executed per second.
In my opinion, it comes down to what your requirements are. If you have a multi-core server that can handle HHVM without crashing or have a site that might have a large number of concurrent hits, then it would perform better for you. If you are looking for a stable WordPress platform for the future, that performs better than PHP 5, then you should go for PHP 7. I won’t be surprised if PHP 7 catches up to HHVM or even surpasses its performance in the coming days
I am a Co-Founder at WPOven INC currently living in Vancouver, Canada. My interests range from Web Development to Product development and Client projects. I am also interested in web development, WordPress, and entrepreneurship.