“Consider that many Facebook engineers spend their days developing PHP code in an endless edit-reload-debug cycle. The difference between 8-second and 5-second reloads due to switching from HipHop interpreter to the HipHop Virtual Machine makes a big difference to productivity.” That’s how Facebook explains the significance of its new PHP executor, HipHop Virtual Machine, announced today. It’s 60 percent faster than the HipHop interpreter Facebook currently uses. HHVM will improve the performance of Facebook’s code and speed up the development process without forcing Facebook to switch off of PHP, which its engineers are trained in.
Facebook originally deployed its open source HipHop for PHP in February 2010 to convert PHP into C++. This allows it to save CPU cycles on its web servers. However, it made it difficult to optimize code and required a HipHop interpreteter that took “a lot of effort to maintain”.
So over the last year it developed HHVM to replace that interpreter. Now, ”as compared to HipHop interpreter, the HHVM bytecode interpreter is approximately 1.6X faster for a set of real-world Facebook-specific benchmarks.” However, we’ve received reports that Facebook’s old HipHop interpreter was relatively slow to begin with, compared to a native PHP interpreter.
For more technical details, check out the in-depth blog post about HipHop Virtual Machine. Eventually, Facebook may run all its PHP through HHVM. First, it is working the kinks out of the HipHop translator. As HHVM is deeply integrated into the source code of HipHop, which is available on GitHub, Facebook hopes “that the PHP community will find hhvm useful as it matures and engage with us to broaden its usefulness through technical discussions, bug reports, and code contributions.”
Update: Due to an error on the part of The OutCast Agency, Facebook’s PR agency, this article originally stated incorrectly that HHVM provided a ”90 percent reduction in memory cost” over Facebook’s existing HipHop interpreter. The agency sent us this incorrect information based on an early unpublished draft of Facebook’s post on HHVM that was later corrected by Facebook’s engineers.