What does HipHop PHP mean for CodeIgniter?
February 3rd, 2010
Facebook announced their open source project HipHop PHP yesterday and the web development community has been in a whirlwind of discussion about what this means, particularly for the PHP community.
HipHop PHP is essentially a compiler (although Facebook calls it a transformer) from PHP to C++. Only a subset of PHP functionality is compatible with the compiler but the developers say they only omitted some of the lesser used functions like eval(). The C++ code is truly cross-platform and can be compiled and run on virtually any server, the primary benefit being decreased CPU usage and therefore increased speed when delivering content to the end-user.
So, what does this mean for the CodeIgniter community? In short, absolutely nothing. Most CodeIgniter developers are building applications that will run on shared hosts, virtual private servers or a cloud-based virtualization system. Of that very large group of our community, an extremely small number have the capability to compile the HipHop binaries or alter their configuration in order to serve HipHop pages.
There are a very small number of CodeIgniter applications that are running on a couple of dedicated servers. Even these developers have no need for HipHop! The performance benefits gained by running HipHop on these server would be marginal at best, if even noticeable. These sites just don’t have the traffic to see measurable gains in performance by focusing on CPU usage. Their time is much better spent focusing on the standard bottleneck: input/output (database queries and caching of output).
It wasn’t until two years ago Facebook had enough traffic to make optimizing CPU usage a worthwhile focus of developer time. Compete won’t let me go back and look at traffic two years ago but I think the graph above speaks for itself: Facebook has more than doubled its monthly unique visitors in the past year. Most of us will be lucky to see .01% of that traffic on our applications (to put it more in perspective, codeigniter.com currently received .03% the traffic Facebook does).


February 4th, 2010 at 4:20 am
>The performance benefits gained by running HipHop on these server would be marginal at best, if even noticeable. These sites just don’t have the traffic to see measurable gains in performance by focusing on CPU usage<
But what if my site does aspire to have those levels of traffic? Are you saying codeigniter is not up to the job if it ever reaches them?
February 4th, 2010 at 8:19 am
@wefsdg No – everyone’s site aspires to reach those levels. The point is, don’t worry about that bridge until you get there – you have far more important things to worry about (input/output). PHP only consumes CPU cycles when a file is being parsed (roughly the time it takes a page to render when requested). If you really analyze your server, I’d be willing to bet the system clock requires more CPU usage than PHP does over the course of a month (unless, of course, you are running a popular website).
Why focus on saving 50% of 3% (CPU Usage) when you can focus on saving 10% of 30% (Database Queries)?
February 4th, 2010 at 8:37 am
Ok, so lets say for arguments sake that I DO have those levels of traffic. My I/O is now optimized 100% and CPU is now the problem. I now have to worry about it.
>What does HipHop PHP mean for CodeIgniter?
You have not answered this question in any way. Saying ‘you will never reach the levels needed’ is a sweeping generalization that doesnt apply to everyones application.
February 4th, 2010 at 9:12 am
Then obviously you should give HipHop a try – there is nothing magic about CodeIgniter, it’s just PHP code. They’ve yet to release the source or tell us what features of PHP they failed to implement (other than
eval()) so we really can’t setup an install of CodeIgniter running on HipHop to test or dig through the code looking for PHP functions that will not be supported just yet.February 4th, 2010 at 11:29 am
so your answer to
>>What does HipHop PHP mean for CodeIgniter?
is essentially
‘i have no idea’.
February 4th, 2010 at 1:51 pm
From the narrow “the title of the post is the entirety of the content” view: yes. No one has any idea what HipHop means except for the Facebook developers.
But, as this post describes, it would mean reduced CPU Usage. Maybe this post could be subtitled, “Should I worry about HipHop yet?”
February 25th, 2010 at 9:50 am
Author +1
Commenters, do I really need to say it? FAIL.
April 2nd, 2010 at 9:23 am
It is really interesting idea to use c++ for web. Maybe in the future will be used only one for web developers. I don2T know what time will show us, Lets see .
June 12th, 2010 at 9:28 am
Code Igniter makes use of eval to for example create the DB object dynamicly depending on the db driver setup…
so hiphop means NO GO for code igniter users…
September 1st, 2010 at 6:35 am
The use of eval in CI is exceptionally easy to work around.
That said, I see no reason why a business that is growing should not consider the use of HipHop as well as many other things (like memcache) sooner rather then later. It would be easier to deal with such a deployment when you are getting a thousand hits a day then 100K.
September 26th, 2010 at 4:06 am
My site built with CI is seeing around 3 to 5 million request per day and uses around 20 Databases for the data. It is currently on a cloud and using a lot of CPU cycles.
Do you think that HipHop could help us manage our load better?
December 7th, 2010 at 11:07 pm
Clients have asked us for an in-house version of our web app written in PHP. Since we are considering offering this to them, HipHop would help provide some basic code obfuscation.
What do you think ?
December 8th, 2010 at 1:50 am
@Bogdan
It would work, but you are seriously limiting the platforms (and increasing the work-load and ultimately support from your company) that your end-user could install the application on.
There are better obfuscation solutions available but the greater question is: why not setup some effective license and allow the end-user to see the code in all its glory?
June 27th, 2011 at 2:18 pm
I generally agree with you that most people wont need the performance advantages of HipHop unless their site grows especially big. That said, seeing your site scale easily with a decent userbase, or just knowing your homepage renders 10x faster than your competitors is huge for most coders.
The performance gains from hiphop seem pretty cool (ie. see benchmarks at the bottom of http://moisadoru.wordpress.com/2010/03/02/static-call-versus-singleton-call-in-php/) HipHop is undoubtedly extreme in terms of performance optimization, and must be if it can handle facebook’s 500 million+ userbase.
However, I’d love to see an article comparing an out-of-the-box opcode cache like APC & eAccelerator running with Memcache vs HPHP. An opcode/memcache setup is rather common at this point, compared to the esoteric nature of HipHop, and provides a much more accessible approach imo. It would be nice to know how certain benchmarks overlap between raw php, opcode+mc, & hphp in order to help someone determine when they would need one solution over another.