Never content with good enough when it comes to speed, Facebook has taken its open-source, PHP-boosting HipHop technology to the next level for programmers. With the new HipHop Virtual Machine, Facebook claims it has improved upon HipHop interpreter performance by 60 percent, meaning PHP developers can be even more productive. Looking forward, HipHop VM will help improve PHP performance on the Facebook website.
In its original form, HipHop converted PHP to AST to C++ to x64. Not only has it boosted performance for Facebook, but also for a variety of other PHP-based sites, including Drupal, MediaWiki and WordPress. But Facebook wanted to make HipHop even better, so it undertook the HipHop VM effort.
In a blog post introducing HipHop Virtual Machine, Facebook software engineer Jason Evans describes it as an experiment in just-in-time translation of PHP to native machine code with the ultimate goal of further boosting performance over the original HipHop incarnation. The execution engine consists of a new interpreter that turns standard PHP into HipHop bytecode, and a dynamic translator that turns the HipHop bytecode into x64. The dynamic translator aims to replace Facebook’s existing HipHop compiler, which Evans says is somewhat problematic because it’s a static compiler while PHP is a dynamic language.
“For perspective on why this matters, consider that many Facebook engineers spend their days developing PHP code in an endless edit-reload-debug cycle,” Evans said. “The difference between 8-second and 5-second reloads due to switching from hphpi to the hhvm interpreter makes a big difference to productivity, and this improvement will be even more dramatic once we enable the translator.”
Presently, Facebook uses the new interpreter for day-to-day development, but is working on narrowing the performance gap between the existing HipHop compiler and the new dynamic translator, as well as generally stabilizing that component. However, the company thinks HipHop VM “will eventually outperform statically compiled binaries in Facebook’s production environment.”
Evans’ post describes the technical details of HipHop VM, as well as Facebook’s plans for making it ready for production. Although HipHop VM is relatively Facebook-specific right now, one has to assume it will become more widely adopted as it matures, and will gain traction among a number of large-scale PHP deployments.
Image courtesy of Flickr user jpctalbot.
Disclosure: Automattic, the maker of WordPress.com, is backed by True Ventures, a venture capital firm that is an investor in the parent company of this blog, Giga Omni Media. Om Malik, founder of Giga Omni Media, is also a venture partner at True.