Which helps Facebook developers work faster and will eventually be used on the site

Dec 10, 2011 14:21 GMT  ·  By

Facebook has announced a new development for its 'PHP to C++ converter' HipHop. There is now a HipHop virtual machine, which converts PHP code on-the-fly and also provides a huge performance boost over previous methods.

Almost two years ago, Facebook unveiled HipHop, a tool for converting PHP code into native bytecode that is much faster to run. The tool is used extensively by Facebook, all of the site's code is converted via HipHop, but also other sites.

However, the code on the site is converted via a HipHop static compiler. PHP code that is ready to go on the site is compiled into binary form and then deployed.

This method has significant disadvantages since it makes maintaining and optimizing code harder and it also adds several steps where bugs can creep in.

In day to day development, Facebook uses a HipHop interpreter that converts code on the fly. This is too slow to use on the site, but it's better than having to compile every change. But this means that Facebook has to maintain both the compiler and the interpreter and there may be differences in how the two convert code.

This is where the new HipHop virtual machine comes in, it's a just-in-time (JIT) compiler that has the benefits of producing fast code but also compiling on-the-fly.

Now, the virtual machine is used by Facebook during development. Already, it's 1.6 times faster than the interpreter. However, the plan is to eventually use the virtual machine on the Facebook site since the developers believe they can make it just as fast as the statically compiled code.

Facebook is also open sourcing the virtual machine so that others can work on it or use it for their own sites. There are more details on how the new tool works in a post on Facebook's developers page, but for the regular Facebook user is that the site is going to be faster and new features will come sooner since developers will spend less time working on them.