Scalability: Facebook Releases HipHop – An Open Source PHP to C++ Transformer

Facebook is written mostly in PHP, which generally scales well for most sites. Large scale web sites can greatly reduce memory resource utilization as well as CPU resource utilization by eliminating unused and inefficient code instructions.

Although PHP is considered to be a scripting language, PHP’s parser does in fact compile code before it is processed by the Zend Engine. Opcode caching allows compiled PHP code to be shared and recycled in memory, rather than compiling the PHP source on the fly. Opcode caching is already available in Zend Server’s community edition and will be available when PHP6 is released.

HipHop takes a much more aggressive approach to performance optimization by translating the source code into C++ which can be compiled into more machine specific instructions. Not only does HipHop compile the source code into a more system friendly language, it also rewrites your code to be more efficient. Through static binding, scripty system calls and functions such as eval() are eliminated and loosely defined types are tightened up to meet specific runtime requirements. Here is an illustration of how HipHop optimizes PHP:
[m-img src=”” alt=”How Facebook HipHop Optimizes PHP” /]

According to Facebook’s Senior Engineer Haiping Zhao, HipHop reduced Facebook’s CPU overhead by 50%!

HipHop will be released tonight under the open PHP license.

Tagged with: , , , ,
Posted in software development
4 comments on “Scalability: Facebook Releases HipHop – An Open Source PHP to C++ Transformer
  1. Mathilda Mcnealy says:

    I love this

  2. Orville Vanveen says:

    Thats dope…

  3. Daniel Millions says:

    I didn’t see a link anywhere but do you offer advertising? I have several blogs in related niche and I would like to add my banner somwhere on your page.

  4. Celeste Burdex says:

    yarr matey! Im at University of Washington and having a great time here studying the effects of rap on my psyche! Anyway im a sorority and loving life, parties, men, you know!