Below, we match PHP 7 with its closest competitor HHVM (HipHop Virtual Machine). The first one is a programming language created by Rasmus Lerdorf for web development and general purposes, the second one is a virtual machine created by Facebook developers for executing PHP applications. Today, HHVM outperforms all available PHP versions, but everything should be changed with the first stable release of PHP 7 and its further updates.
What is actually happening behind HHVM? As mentioned above, it is an open-source virtual machine, but in addition to PHP applications it also executes programs written in Hack. Besides, HHVM relies on a JIT or just-in-time compilation approach; therefore, the virtual machine combines superior performance of JIT with the development flexibility that PHP provides. As you can see, HHVM is already better for running PHP apps, since it provide additional features related to just-in-time compilation, but why is JIT so powerful?
Instead of compiling PHP code to C++, the virtual machine compiles it into an intermediate bytecode, which is translated into x64 machine code. At this stage, a JIT compiler is utilized: it dynamically runs the translation at runtime, allowing for all sorts of optimizations unavailable in a statically compiled binary. As a result, the performance of your PHP applications is increased. This feature makes HHVM so popular among developers: it runs much of the world’s PHP projects. Moreover, the virtual machine supports the top 20 PHP frameworks, so it’s a perfect addition to your arsenal of PHP tools.
As for PHP 7, it is the upcoming version of a popular scripting language that is widely used by web developers. If a current PHP version (5.6) is fast, flexible, and pragmatic, PHP 7 is even better, as it introduces tons of new features and improvements. Now, the language powers everything from simple blogs to the most complicated websites; and PHP 7 offers even better opportunities, but how can we compare it with HHVM? It’s time to draw your attention to Zend, which is the default PHP execution engine. It is not as powerful as HHVM is, but the native PHP ecosystem is now responding to the HHVM world with PHP 7, which promises 100 percent increase in performance over older versions.
Besides, PHP 7 features a range of execution engine improvements, offers native local threat storage, and reduces memory usage. It is also able to handle more traffic within the same server resources. But all these features are useless in the competition with HHVM without JIT execution capabilities, which are now available in PHP 7. Thus, dynamic compilation of Zend opcodes into native machine instructions is a part of new language, but does it mean that HHVM will be outperformed in the nearest future?
Since PHP 7 is essentially repurposed according to the requirements of a JIT compiler, it promises even better performance with the newer versions.
Another competitive advantage of HHVM is asynchronous programming. Luckily, PHP 7 is developed with this feature in mind. The latest version of the programming language facilitates simultaneous execution of asynchronous tasks. As a result, future iterations of PHP will support support asynchronous programming. Furthermore, among the available tasks PHP 7 will support such important actions as access to database, timers, and networks as well as perform I/O operations related events. Besides, the new improvement will allow PHP servers to handle simultaneous requests from a single memory pool. Looks good, isn’t it?
Unfortunately, we still don’t have the final PHP 7 version, and all these talks are based on early benchmarks performed with various betas and different articles, but it is already known that:
On WordPress, HHVM demonstrates better performance than PHP 7. According to WP tavern, it is 18.7% faster. A similar benchmark on talks.php.net also illustrates that HHVM outmatches PHP 7.
While we are waiting for the stable release of PHP 7 to find out who is a true winner in the battle, it is obvious that HHVM is significantly faster than all stabile PHP-Zend packages. Only PHP 7 or PHPng (PHP Next Generation) can become a competitor to HipHop Virtual Machine.
For those developers using PHP with Zend, we’d like to insist that the switch to HHVM will not solve all your problems immediately. For large environments and complex websites it takes months to migrate from one engine to another. The complex transition requires a lot of time and effort and may lead to unexpected problems.
Thus, all the benefits of HHVM can be revoked by problems related to the migration. Moreover, PHP 7 is going to become a real threat to Facebook’s project, so it’s better to switch from one PHP version to another. Both HHVM and PHP 7 make a lot of performance improvements possible, as a result, there is no need to spend resources on the implementation of the alternate engine.
We recommend you to check the following interview with Andi Gutmans, CEO and co-founder of Zend. He shares some secrets related to PHP 7 and tells, why the new version of the popular coding language is better than HHVM. Of course, you can disagree with this statement in case of better experience with HHVM. Thus, we’d love to hear your arguments against using PHP 7 in the comments below, opposite ideas are also welcome.