Tim Igoe's Web Design, Development and Hosting Blog

Blog > Thoughts on Facebook's HipHop for PHP

Yesterday Facebook answered rumors and announced their HipHop "compiler" for PHP project. http://developers.facebook.com/news.php?blog=1&story=358

Facebook describe it as a source code transformer and has allowed Facebook to massively increase the operational speed of the PHP elements of the site. HipHop gains its performance by taking the PHP and converting it into C++, this C++ can then be compiled into more efficient machine code.

Interpreted scripting languages, like PHP, are brilliant for developing because they are simple to learn and easy to debug but being interpreted they have the major disadvantage of poor performance. Every time a script is run, it is first compiled into 'opcode', a half step between the raw PHP and a form of machine code. This is then interpreted by the PHP runtime. Currently, there are a few opcode caching systems in existance, APC, eAccelerator and xCache all cache the opcode each time the PHP scripts change to speed up the process of executing the scripts.

HipHop goes one step further, and converts the PHP into C++ that can be compiled into machine code itself, but to do this the Facebook developers have decided to sacrifice "some rarely used features -- such as eval()". A very important question here is what have they decided are rarely used features and what have they dropped support for.

Dropping features changes the language itself and to use this new "language", you'd have to be well aware of what is missing and work around it, it isn't just as simple as looking at the PHP documentation and knowing you've got access to everything there.

Currently, Facebook haven't actually released the source code, however I am still interested to see how it works but currently I know I cannot use it due to various requirements for eval() in, for example, my plugin system and the vBulletin forums.

Similar Articles from the web

hiphop for php
Community News: Responses to the Facebook HipHop Announcement
Thoughts on Facebook's HipHop for PHP

Post a reply