PHP HipHop – What It Means

Posted by on February 3rd, 2010

HipHop_logo_white There has been a lot of speculation about PHP, Facebook, and a big announcement. Over the last few weeks, several predominate PHP community members were invited to the Facebook offices to check something out. Facebook asked the PHP members, as Ben Ramsey put it, to “make a gentleman’s agreement that I wouldn’t talk until FB is ready.”

Well, Facebook has made their announcement, and it is called HipHop. Here is an excerpt:

Today I’m excited to share the project a small team of amazing people and I have been working on for the past two years; HipHop for PHP. With HipHop we’ve reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page. Less CPU means fewer servers, which means less overhead. This project has had a tremendous impact on Facebook. We feel the Web at large can benefit from HipHop, so we are releasing it as open source this evening in hope that it brings a new focus toward scaling large complex websites with PHP. While HipHop has shown us incredible results, it’s certainly not complete and you should be comfortable with beta software before trying it out.

HipHop for PHP isn’t technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP’s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

Marco Tabini has a nice summary on what PHP need to know about HipHop. However, people I’ve talked to have had several opinions on HipHop, ranging from pure delight to doubts to indifference. Personally I think this is a great thing for PHP, and I’ll tell you why.

HipHop will enabled business to pick a web scripting language and use it from start-up to internet-giant. While HipHop isn’t the first tool used to speed up PHP, such as APC, Memcached, and others; it is more of a current reminder: PHP is serious about the web. For people already using PHP, this is just a nice feature. For those who aren’t using PHP, it shows that it is a very strong candidate.

I’ve worked in a non LAMP shop before. To non-PHP people, it has the stigma, regardless of actual performance, of being hard to scale. It is a “scripted language”, and in the Java / .NET world where I was working, it was looked at as being an absurd choice. Now, PHP can make a strong case of being able to mature with your application and scale appropriately.

One fear that I have as a Project Manager, and anyone has who decided on the technology that they will implement, is “picking the wrong team.” During my .NET days, Microsoft’s team announced a new technology for .NET applications. It showed a lot of promise and simplified some things that were a pain in .NET. Our team adopted the new technology and ran with it. It wasn’t perfect, but we liked it. Less than a year later, Microsoft announced that it would be moving the project to a drastically different team, which basically meant “there wasn’t enough adoption, so we’re putting this project on the back burner.” The new team was basically to maintain the code forward, but not develop new features.

What happened is we invested on this new technology, and we saw the potential it would have in the future. We lost our investment, since that future potential would never be realized. Now our projects had this new technology embedded in many spots. Re-writing those places would take a great deal of time. From a Project Manager perspective, it was a poor choice.

For PHP, the emergence of HipHop, a concept that is working across thousands of production servers, it sends a strong message to the web development community as a whole. Not only is PHP widely adopted, flexible yet powerful, and easy to implement. PHP is competitive, and is continually evolving to adapt to web developer’s needs. It is a safe bet for many projects, and it isn’t going anywhere but up.

Will I be implementing HipHop right now? Probably not. Ilia Alshanetsky has a very healthy reality check on what HipHop is for. But the bottom line is I don’t need what HipHop is offering yet. I can see very great uses in the future for Dating DNA’s compatibility generation, as well as certain pieces of other PHP projects that could use a serious performance boost. But for now, my Blog will not be HipHoping along. I’m excited for not only what HipHop does, but what it’s greater underlining meaning as a whole with PHP.


Justin is a Sr. Director of Engineering at Deseret Digital Media, Previous President of the Utah PHP Usergroup, and frequently works with the Utah Open Source Foundation which organizes the OpenWest Conference. Justin loves just about anything with web technologies from PHP, JavaScript, Node.js, Salt, and managing engineering teams.

Learn More