Home PHP HipHop for PHP announced
HipHop for PHP announced PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Nate Lyman   
Wednesday, 03 February 2010 17:15

HipHop for PHPYesterday, Facebook announced a substantial contribution to the PHP community, HipHop for PHP.  This isn't the first time Facebook has contributed to the Open Source community.  In the past they have contributed enhancements to APC, memcached, and also PHP itself.  HipHop for PHP is a revolutionary release for the PHP Community.  It gives PHP the scalability and performance of a compiled language (C/C++/Java) but keeps most of the flexibility of a scripting language.

Facebook has implemented HipHop for PHP on it's own site and has seen a reduction in CPU cycles in upwards of 50%.  For a site that serves 400 billion page view a month that is substantial.  While 50% efficiency gains on your server are amazing, HipHop for PHP is really directed at large scale PHP implementations.  For your average business website or blog it would be total overkill.  But complex web applications it is a game changer to say the least.

At a macro level the way HipHop for PHP works is fairly straight forward.  It takes your PHP, generates C++ code, then compiles it with the g++ compiler. To do this Facebook had to re-write a version of the PHP parsing engine, and turn PHP type-less variables to typed variables using a type-inference engine.  The type-inference engine is smart enough to look at your code and decide which variable is an array, object, int, string, etc...

In addition to HipHop for PHP, Facebook also released HPHPi which maintains the level of rapid development for engineers.  Normally when working with a compiled language you have to write your code, compile it, then test it.  HPHPi lets you write PHP they way you are used to doing it, quickly iterating on your code.  Once you get to the point of starting Unit-Testing you would then compile the code.

All of this magic took over 300,000 lines of code and 5,000 unit tests.  I think it says a lot about a company to share a project that really brings PHP to the next level.  I'll admit I've made my fair share of jabs at Facebook, but contributing to Open Source is really terrific.

 

Last Updated on Wednesday, 03 February 2010 17:18
 

Add comment


Security code
Refresh

@natelyman

natelyman: Happy 103993/33102 Day!
natelyman: @chitownforte22 it smells like a turd covered in burnt hair!
natelyman: @mikvogel @rgiertz @chriswoods85 Vogel hit the nail on the head.
natelyman: My flight is booked for PHP Tek-X in Chicago May 18-22 Woohoo!