PHP 7 Vs HHVM: Which One’s Cut For My WordPress CMS?by Adeesh Sharma February 13, 2017 1 comment
While PHP is still considered the favorite scripting language of many web developers, a virtual tool capable of executing PHP code called Hip Hop Virtual Machine (HHVM) has been giving tough competition. The users of both platforms argue superiority of one over the other, the choice for someone starting new would depend on his familiarity with either of the platforms.
How HHVM was conceived
HHVM was developed by Facebook in 2010 and released for public next year. The idea behind its development was to reduce server resources and thereby provide a faster experience to Facebook users. This it does by quickly converting PHP code into machine code, using a Just in Time compiler. The use of a JIT compiler provides a massive boost in performance over the erstwhile PHP 5. Moreover, because of Facebook support there’s a huge community of developers out there working to constantly improve it so you are never short on support. HHVM requires lesser memory space to execute requests and it’s actually quite easy for any developer to install and work with HHVM. However, there are a few negatives associated with HHVM that you should be aware of. You need to first convert custom extension before you can add to them to your website. Also, it does not support all WordPress themes and Plugins and requires overall more memory than PHP 7 so it should not be used on servers with less than 2 GB RAM.
Comparing PHP 7 With HHVM in performance
Undoubtedly, PHP 7 provides a much improved performance over PHP 5. It directly interprets and executes code on the server using the standard PHP interpreter, which is free for all. The generated HTML code is transmitted to the client and displayed on the screen. The PHP interpreter and HHVM both execute PHP code, so the actual code writing effort is the same. HHVM has to be installed on the server before you can use it. Also, it converts PHP code into Hip Hop bytecode before translating it into machine code and executing it. This results in filtering out of the inefficiencies of the PHP code and thus results in improved performance.
The request handling limit for PHP 7 is almost double that of PHP 5.6 and also it responds to request much quicker. Also, by modifying how it handles data internally, PHP 7 is much more memory efficient as compared to the previous PHP version. However, PHP 7 is outmatched by HHVM in many performance metrics and isn’t ideal for very high traffic websites such as Facebook. Moreover, some themes and plugins are not yet compatible with PHP 7.
Which one should you eventually choose?
There are no definitive benchmark standards that one can quote to claim which out of the two: PHP 7 and HHVM is better. However, one thing is for sure: both vastly outperform the older versions of PHP.
On WordPress sites, it has been found that those using HHVM consume fewer CPU resources which allows for more transactions per second for a high number of concurrent requests. So, what you choose depends on your capacity and requirements. For websites that receive huge concurrent hits, HHVM may be the better option provided you have a multi-core server to handle it.
Experienced developers would feel a lot more familiar with working on PHP 7 as there’s hardly any learning curve to be overcome. However, when a website is bombarded by multiple requests, HHVM consumes less memory than PHP 7. Whatever you eventually choose would atleast help your website perform better as opposed to a poorly performing website on an older PHP platform.