In association with heise online

14 December 2011, 12:07

Facebook use HipHop virtual machine for faster PHP

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

Facebook logo Facebook has announced that it has been developing a virtual machine for running PHP applications and is already switching to using it for development. The HipHop virtual machine builds on work the company has done to get the maximum performance from its PHP codebase.

Facebook uses a large amount of PHP code in its systems and has been seeking optimal performance for its code. In February 2010, it published the first version of HipHop, a PHP to C++ compiler (hphpc) which is currently used at the company to produce high-performance binary versions of its applications. But the use of the compiler, with its idiosyncrasies, meant that Facebook had to develop its own interpreter for HipHop PHP, hphpi, to use for day-to-day development, and this was reported to be "twice as slow as PHP".

As Facebook continued to develop its PHP performance improvements, both at runtime and during development, it began to investigate the possibility of using dynamic translation to native code. That investigation became the start of the development of the HipHop virtual machine (hhvm), which Facebook eventually plans to use for all PHP execution. The hhvm system compiles PHP first to HHBC, HipHop Byte Code. At run time, it then uses a dynamic translator with simple tracing to create 64-bit x64/x86 code.

The current performance of the HipHop virtual machine places it at 60 per cent faster than the HipHop interpreter, fast enough that the company is already switching to it for development work. It is only 25 per cent of the speed of their C++ compiled code though, but it is hoped that it will close that performance gap as the dynamic translator improves. The hhvm project is described as 90 per cent done and that "now we're on the second 90% as we make it really shine".

The hhvm code is "deeply integrated" with the other HipHop projects and is shared through the github hiphop repository. The code, as with the rest of the project, is generally licensed under PHP and Zend licences, and potential contributors will need to sign a Contributors Licensing Agreement (Facebook login required).

(djwm)

Print Version | Send by email | Permalink: http://h-online.com/-1395163
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit