Home Better, Faster, Stronger PHP: Facebook Introduces HipHop Virtual Machine

Better, Faster, Stronger PHP: Facebook Introduces HipHop Virtual Machine

Facebook is announcing a new execution engine for PHP in order to try to boost performance. Facebook introduced HipHop for PHP nearly two years ago. Today the company announced a new tool in the HipHop toolbox, which it claims is 60% faster, with a 90% reduction in memory cost.

Facebook engineer Jason Evans writes that the company put together a team last year to replace the HipHop interpreter (HPHPi). Today they’re taking the lid off of the new HipHop Virtual Machine (HHVM) which will replace HPHPi and eventually be used in production.

We’ve covered HipHop before, but in a nutshell, it is a tool to transform PHP into optimized C++ to help reduce CPU usage compared to using Apache and PHP. HPHPi is used during development, but can be very slow to run PHP.

What is HHVM?

According to Evans, HHVM is a “high-level stack-based virtual machine specifically tailored to PHP that executes HipHop bytecode (HHBC).” Evans says that HHVM is “approximately 1.6X faster for a set of real-world Facebook-specific benchmarks.”

Facebook used HPHPi while developing, and uses the HipHop compiler (HPHPc) to compile binaries to run the Web site. In the long term, Evans says “we predict that hhvm will eventually outperform statically compiled binaries in Facebook’s production environment, in part because we are already sharing enough infrastructure with the static compiler that we will soon be able to leverage static analysis results during tracelet creation.”

However, that’s a bit down the road. HHVM is still in the development stage and Evans says there’s “uncertainty regarding the translator’s behavior when running the entirety of Facebook’s PHP codebase.”

But he says that the “first 90%” is done and “now we’re on to the second 90% as we make it really shine.”

HipHop is an Acquired Taste

Like its namesake, HipHop is not for everybody. It may have some significant drawbacks, depending on how you’re using it. Facebook’s environment is, if not unique, at least very unusual. Former Facebook developer Evan Priestley listed a number of downsides to HipHop on Quora in September. Some of Priestley’s complaints (such as using the HipHop interpreter when developing code) are answered with HHVM. But others, like behavioral differences between HipHop and PHP, are issues that developers and organizations considering HipHop need to be aware of.

It’s generally acknowledged that HipHop is not for all applications. Priestley says that it may not provide any performance benefit if the application is not CPU bound. He also says that deployment and support is more complicated, and that diagnosing problems with HipHop is more complex because “you generally have to rule out application bugs first, then verify there is a PHP vs HPHP behavioral difference.”

However, it seems to be working for Facebook and the new HHVM tool answers at least some complaints about earlier iterations. If you’re running a particularly hefty PHP-driven site, it might work for you too. The project is on GitHub. Evans says that HHVM is “deeply integrated” in the HipHop source code, so it should be there for interested developers to play with already.

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.