HHVM was created as the successor to the HipHop for PHP PHP execution engine, which is a PHP-to-C++ transpiler also created by Facebook. Based on the gained experience and aiming to solve issues introduced by HPHPc, Facebook decided in early 2010 to create a JIT-based PHP virtual machine. Issues associated with HPHPc included its reaching of a plateau for further performance improvements, lack of full support for all features of the PHP language, and difficulties arising from specific time- and resource-consuming development and deployment processes required for PHP projects that used HPHPc. In Q1 2013, the production version of the facebook.com website stopped using HPHPc and switched to HHVM. Following the JIT compilation principle, HHVM first converts the executed PHP or Hack code into a high-level bytecode, HHBC, which is also known as an intermediate language. HHBC is a bytecode format created specifically for HHVM, in a form that is appropriate for consumption by both interpreters and just-in-time compilers. As the next steps in execution, HHVM dynamically translates the HHBC bytecode into x86-64 machine code, performs its additional optimizations through a dynamic analysis of the translated bytecode, and executes the x86-64 machine code. As a result, HHVM has certain similarities to the virtual machines used by other programming languages, including the Common Language Runtime and Java virtual machine. HHVM brings many benefits in comparison with HPHPc, and one of them is almost complete support for the entire PHP language as defined by the official implementation of PHP version 5.4, including the HHVM's support for create_function and eval constructs. Furthermore, HHVM uses the same execution engine when deployed in both production and development environments, while supporting integration between the execution engine and the HPHPddebugger in both environment types; as a result, maintaining HPHPi separately as a development utility is no longer needed as it was the case with HPHPc. HHVM also eliminates the lengthy builds required by HPHPc to run PHP programs, resulting in much simpler development and deployment processes than it was the case with HPHPc. Together with HHVM, Facebook also released Hack, a derivative of PHP that allows programmers to use both dynamic typing and static typing, which is a concept also known as gradual typing, and allows types to be specified for functionarguments, function return values, and class properties; however, types of local variables cannot be specified. At the same time, Hack does not provide complete backward compatibility by not carrying on some of the PHP features, such as the goto statement and dynamic variable names. In September 2017, it was announced that version 3.24 would be the last version of HHVM to officially support PHP, and that HHVM will only support Hack going forward, citing differences and incompatibilities in PHP 7.
Performance
As a process virtual machine that provides the execution environment, HHVM has the ability to use live type information to produce more efficient native code, leading to a higher web serverthroughput and lower latency. In Q4 2012, the execution of facebook.com's source code on HHVM achieved performance parity with HPHPc, and in December 2013 HPHPc was even surpassed by around 15%.