HHVM vs PHP

Home » Programming » HHVM vs PHP

HHVM vs PHP

HHVM vs PHP

PHP is the most popular scripting languages used for web development. PHP 7 is a new version of language that is been optimized for fast performance. PHP also has a rival HHVM (HipHop Virtual Machine) — a virtual tool that executes PHP code. There is a bit difference between these two, let’s have a look to it.

HHVM

  • HHVM was started by Facebook in 2008. A tool to convert PHP script into C++ so it could be compiled and executed on web servers. The aim was to conserve server resources, an important goal, as Facebook’s user base was growing rapidly. It allowed the server to accommodate three to four times more traffic than it had managed before.
  • After 2010, Facebook’s server needs had grown even more, making a need to allow it to operate more efficiently. In response to this demand, Facebook developed the HipHop Virtual Machine (HHVM).
  • HHVM uses Just-In-Time (JIT) compilation to convert PHP code into a type of bytecode. It then converts this bytecode into machine code and optimizes it so that it runs as quickly as possible.
  • This virtual tool created by Facebook works with a great speed when compared to the use of PHP 5.

PHP 7

  • PHP 7 is an attempt of the communities that support the platform against the rise of HHVM. The aim of launch of PHP 7 claimed that it would offer more than 100 percent performance improvements over the previous version, PHP 5.
  • PHP 6 is skipped, the development on PHP 6 began in 2005. But it went on so long and ran into so many problems. As a result, the PHP community decided to skip the name PHP 6 and go straight to PHP 7 as a new working version.
  • It is clear that PHP 7 offers speedier performance. Instead, the consideration is how PHP 7 compares to HHVM. Many experts have conducted tests on the two ways of handling PHP code, which has shown some interesting results.

Similarities / Differences

Code Interpretation

  • The difference between PHP 7 and HHVM is the way in which both of them interprets PHP code. PHP 7 uses the standard PHP interpreter, free software that is available for anyone to use, to directly interpret and execute PHP code on the server. This generates HTML code, which is then sent to the client. The client then displays the desired content to the web user.
  • HHVM first converts PHP code into HipHop bytecode. This code is then translated into machine code and executed. Some optimization takes place during this translation, ironing out inefficiencies in PHP code with the aim of delivering faster performance.

Coding style

  • Both the PHP and HHVM take PHP code and execute it. Therefore, the process of writing the code is much the same in each case.
  • If you are thinking for HHVM, you need to install it on your server and then call it using the hhvm command on the command line.

Testing

  • HHVM has offered much faster performance than previous versions of PHP. However, recent benchmark tests suggest that PHP 7 is slightly faster than HHVM, at least in some situations.
  • Check some of results by Kinsta.
  • Here is a nice article for WordPress developers for HHVM.

Results

Wikimedia – After deploying HHVM shrank CPU load from 50 to just 10 percent, halved the time taken by users for submitting edits and reduced the average page load time from 1.3 seconds to just 0.9 seconds.
Etsy, Box.

Future

  • The future looks bright for PHP 7. Many businesses are already using HHVM to increase performance on their sites. The transition between PHP and HHVM is a bit slow. It took Etsy more than six months to complete the transition. With the speed benefits of PHP 7 compared to HHVM being only very slight, it is unlikely that companies will switch back to PHP.
  • Facebook is continuing to develop HHVM. It has alse announced support for Mac OS X, making the technology accessible for developers who prefer to work in the Apple development environment. HHVM developers have convinced that HHVM is still faster than PHP 7 in many situations, including WordPress.

Benefits of HHVM

  • HHVM uses dynamic translation to deliver faster performance in many situations, including WordPress.
  • HHVM uses less memory to process each request in cases where it faces a very large number of requests.
  • HHVM developers are steadily increasing the number of PHP code bases that the engine can run. It can already run the latest version of WordPress, along with many other common PHP frameworks and applications.

Benefits of PHP 7

  • PHP 7 performs faster than HHVM in some situations, including when running on Drupal 8.
    Using PHP 7 doesn’t require you to install or setup HHVM.
  • Most of the cases code written in PHP 5 works as expected after a transition to PHP 7.
  • PHP 7 is developed by the PHP community, a group with a long-standing reputation for creating stable and reliable PHP releases.

Which to Choose

This is still the question as both of are equally compatible to work on all environment. But if you want to try something different then HHVM is the next thing you need to work with.

I’m a positive and enthusiastic web and mobile developer – and I relish a challenge.