PHP is by far my favorite server-side scripting language, so it comes as no surprise that I'm really excited about HipHop for PHP. HipHop was developed over at Facebook and serves as a means to speed up code execution and reduce server demand. From the Facebook Developer Blog:
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.
What type of impact can HipHop have on your hardware?
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.
It's great to see a company such as Facebook making this type of contribution back to the community, especially in the form of open-source software. One thing is for sure, it will be interesting to see what HipHop can do for PHP as it evolves with the support of the open-source community.
Update (04 February 2010)
The creator of PHP, Rasmus Lerdorf, comments on HipHop:
[Lerdorf] continued to say that raw execution speed was "not a significant factor" for many applications. "Even if you double the execution speed of something that is 10% of your overall request cost, that is only a 5% overall improvement. If on every request you are hitting memcache/postgresql/mysql 10 times and spending a lot of time in system calls, don't expect miracles from HipHop."
He also worries that developers will see HipHop as "some kind of magic bullet" for performance, which could lead to lazy or bad development habits. Instead, Lerdorf recommends holding off on HipHop until the runtime is the biggest thing that's stopping a site from being as fast as possible. This is a very good point, since many developers don't even both to do basic optimization.
It seems as though HipHop may not be as "Hip" as Facebook claims -- unless you're running a Facebook-sized app.