Why is PHP?
• Facebook application is written in 20 millions lines of PHP.
ents (up to
• begin to
• the perform
ance of run
ning on HH
d parity wit
• the producti
d running o
• Traditional static compiler
HPHPc was great
• At the peak of HPHPc, PHP code showed dramatic
performance improvements (up to 6x) compared to Zend
HPHPc was great. But…
• the curve for further performance improvements had flattened.
• did not fully support the PHP language.
• required a very different push process, requiring an over 1GB
binary to be compiled and distributed to many machines in
• HPHPc did not support HPHPd
• HPHPi was becoming slow for development.
• Maintaining HPHPc and HPHPi in parallel was becoming
• HHVM uses HPHPc's PHP→AST implementation and extends the
pipeline to PHP→AST→HHBC→x64 translator
• HHVM converts PHP code into a high-level bytecode (commonly
known as an intermediate language). This bytecode is then
translated into x64 machine code dynamically at runtime by a just-intime (JIT) compiler. In these respects, HHVM has similarities to
virtual machines for other languages including C#/CLR and
• There is near full support for the entire 5.4 PHP language (including
the create_function() and eval() functions).
• here is one execution engine for both production and
development(no need to maintain HPHPi any longer).
• There is both production and development integration with HPHPd.
• HHVM uses a just-in-time compilation approach to achieve
superior performance while maintaining the flexibility that PHP
developers are accustomed to.
• To date, HHVM (and its predecessor HPHPc before it) has
realized over a 9x increase in web request throughput and
over a 5x reduction in memory consumption for Facebook
compared with the Zend PHP 5.2 engine + APC.
• HHVM can be run as a standalone webserver (i.e. without the
Apache webserver and the "modphp" extension). HHVM can
also be used together with a FastCGI-based webserver, and
work is in progress to make HHVM work smoothly with
• try a very simple form of tracing that limits each trace to a
single basic block with known input types.
• simplifies the trace cache management problem, because
complex application control flow cannot create a
combinatorial explosion of traces. Each tracelet has a simple
– Type guard(s)
• prevent execution for incompatible input types, and the remainder of the
tracelet does the real work
– Linkage to subsequent tracelet(s)
1. f() is executed twice, for which the translator
creates three tracelets.
2. f($a, 42) causes creation of tracelets A and B.
3. f($a, "hello") causes creation of tracelet C.
4. B is used by both invocations.
Support for Apache web server.
Support for php.ini and associated options.
Streamlining the installation process.
Support for the ARMv8 (AArch64) architecture.
Ensuring HHVM passes all unit tests for the top 20-30 PHP Frameworks.
Continuing adding missing functionality and extensions so that more PHP
Run the top 20-30 PHP Frameworks in real world scenarios.
First-class documentation around HHVM.
Super easy install on as many distributions as possible.
Who is using HHVM(2014.01)
Miles By Motorcycle
• Intel Xeon E312xx, 2.3GHz, 4 Cores
– Executing multiple select queries to MySQL database.
– Serializing selected dataset to JSON string.