Hip hop

from Wikipedia, the free encyclopedia
HHVM

logo
Basic data

developer Facebook
Current  version 3.23
(November 17, 2017)
operating system Linux , Mac OS X (unofficial)
programming language C ++ , C
category Bytecode compiler
License PHP
hhvm.com

HipHop for PHP is free software that originally translated PHP scripts into C ++ source code for the purpose of increasing performance , which is then translated - usually using g ++ - into the required machine language. In the meantime, a virtual machine for hip-hop is available with HHVM.

It is therefore an alternative PHP implementation, which, however, so far only provides the PHP 5.6 language scope in the standard configuration. For PHP 7 support, the configuration must be adapted accordingly. HHVM also supports the programming language Hack, which is closely related to PHP and developed by Facebook .

HipHop before HHVM

The original HipHop compiler HPHPc converted PHP code into C ++ code. By compiling significantly higher execution speeds are reached or lower processor loads than in interpreting the PHP scripts, for example, by the Zend Engine , in which the commands have to be at least partially re-compiled for each use in the machine language.

A native executable program file was thus generated, which also contains the web server at the same time and thus responds directly to HTTP requests itself and made the web server, for example Apache , unnecessary.

In contrast to other approaches to increasing the execution speed of PHP, HipHop brought a significant further increase in speed up to a factor of 6 and reduced memory usage - among other things, because parallel server requests were not processed in separate processes with correspondingly separate memory areas. This can result in significant performance improvements or resource savings for websites with very high traffic numbers.

HipHop is distributed as free software with source code under version 3.01 of the PHP license . The source code includes more than 300,000 lines in C ++ and C .

HPHPc supports PHP from version 5.3, whereby some less frequently used PHP features such as the dynamic language features eval()and are create_function()dispensed with.

HHVM

Because of the various foreseeable limitations of the debugging HPHPd, Facebook began investigating an alternative approach back in 2010. PHP was executed in a virtual machine , the HipHop Virtual Machine or HHVM for short . HHVM translates PHP code into an abstract byte code ( called HHBC ). This bytecode is then dynamically translated into × 64 machine language by a JIT compiler at runtime . This is comparable to the virtual machine approach of other languages ​​such as Java (JVM) and C # (CLR) or to Microsoft's language-independent Common Intermediate Language for the .NET platform.

As of July 2013, HHVM does not yet support all the functions of PHP 5.4, but goes beyond PHP 5.3. At the end of 2012, HHVM reached the speed of HPHPc.

At the beginning of 2013, Facebook's operations switched from HPHPc to HHVM. This replaced HPHPc for real operation and HPHPd for test operation.

As of August 2014, the Wikimedia Foundation tested the use of HHVM for Wikipedia. Since November 25, 2014, HHVM has been used for all Wikipedia users. Since January 2019, however, a switch to PHP 7 has been tested because HHVM has decided to discontinue support for PHP, it is only supported hack. The use of PHP 7 is currently being tested as a beta feature.

history

HipHop was originally developed on Facebook under the direction of Haiping Zhou on CentOS and Fedora systems. It follows earlier similar developments like phc and Roadsend PHP Compiler (compile to C) or Quercus and Project Zero (Java implementations of PHP) or Phalanger (compiler for .NET). It had been in development for over two years before the release as free software under the PHP license for February 2, 2010 was announced. The deadline could not be kept due to technical problems, but on February 20th the source code ended up in the Git repository as promised . The software is used by Facebook to handle hundreds of millions of users. In the months that followed, HipHop was further accelerated and support for some of the new features of PHP 5.3 was implemented. Furthermore, Hui Chen implemented the porting to 32-bit platforms as part of a Google Summer of Code grant.

Web links

Individual evidence

  1. Fred Emmott: HHVM 3.23
  2. Installation
  3. PHP 7 support. HHVM, April 12, 2015, accessed May 11, 2017 .
  4. Manuel Lemos: PHP compiler performance , PHP Classes blog, February 23, 2010.
  5. Drew Paroski: Speeding up PHP-based development with HHVM (English), Facebook, Nov. 29, 2012
  6. HHVM . MediaWiki (English)
  7. Wikimedia Foundation Report, August 2014 Information (English)
  8. [Wikitech-1] All non-api traffic is now served by HHVM. wikimedia.org, December 3, 2014; Retrieved August 3, 2015.
  9. [Wikitech-1] PHP 7 is now a beta feature. wikimedia.org, January 28, 2019; accessed on January 28, 2019.
  10. phpcompiler.org
  11. roadsend.com
  12. caucho.com/resin-3.1#quercus
  13. projectzero.org/php ( Memento of August 3, 2009 in the Internet Archive )
  14. Scott MacVicar: HipHop for PHP: six months later. In: Facebook Engineering weblog. Facebook, August 13, 2010, accessed November 19, 2010 .