PHP runtime rewritten, by Facebook?

Yes, its true. Facebook has completely rewritten the PHP runtime to make it faster and more efficient, and its completely open source. Named HipHop, its described as a source code transformer, changing PHP into optimized C++ which is then compiled using g++. Thus keeping the best aspects of PHP while taking advantage of the performance of C++. Using HipHop, the Facebook web server CPU usage has been decreased by about fifty percent! And who would have thought that this and many other cool advances in programming, started at a Hackathon.


  1. Laminar says:

    Apostrophes. It’s okay to use them.

  2. osgeld says:

    to bad facebook is STILL slower than any other site out there

  3. dnm says:

    facebook still crashes more often than not, is slow as hell, and is generally a really shitty piece of software. The site’s actual point and usage keeps us all coming back, but the ui and software is all junk.

    Just like PHP.

  4. CodeWar says:

    This could be interesting. I’d like to see something other than Facebook “translated”. But, yes… Facebook is still the slowest website around.

  5. Dan says:

    Facebook is very fast for me and what do you mean “facebook still crashes more often than not” ?

    You mean your browser? Maybe it’s time to remove some of those plugins no?

  6. Ben Ryves says:

    Dan: I assume they mean the constant “Oops, something went wrong” messages you get when attempting to use the site.

  7. Boudico says:

    The only problems with “Oops, something went wrong” that I ever see with Facebook is while using the games. Hardly facebook’s fault

  8. osgeld says:

    its a part of their service no?

  9. xrazorwirex says:

    Considering how massive their userbase is and how much crazy interactive real-time shit’s running all the time it’s impressive none-the-less.

  10. Anon says:

    They’re third-party programs.

    Facebook will have to police them, but for transparency’s sake they rely on the user feedback. So rather than bickering and ranting about it, why don’t you send Facebook some feedback, eh? :D

  11. Ben Ryves says:

    Boudico: I don’t use any third party apps, but encounter those dialogs on a fairly frequent basis (usually when attempting to post a comment on a news feed item or attempting to open the notification item menu in the bottom-right).

  12. walt says:

    why the hell is all of the “new” internet stuff named after something that already exists? it’s so silly. do they honestly think if you google “hiphop” you’re going to find anything about php? so SO silly. I know hiphop music is dead, but come on.. let it keep it’s name.
    R.I.P. internet.

  13. Chris says:

    @walt As with domains, all of the good names have been taken.

  14. Liam says:

    So, what you’re saying Walt, is, “Let’s keep it real” :p

  15. Liam says:

    damn my grammatical error!

  16. osgeld says:

    “why don’t you send Facebook some feedback, eh? :D”

    well when you do that facebook tells you to goto the app maker, the app maker tells you to goto facebook, in reality we know where they are both telling us to go

    I dont mess around with it much anymore

  17. JonW says:

    “Yes, its true. Facebook has completely rewritten the PHP runtime”

    No, it’s not.

    “it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it.”

    Somewhat different…

  18. M4CGYV3R says:

    I’ll stick with PHP. I don’t write huge social networking apps with millions of users, so I should be ok with what everyone else is using.

  19. Flo says:

    Oh boy.. I love the smell of exploits in the morning.

  20. walt says:

    @ chris
    “@walt As with domains, all of the good names have been taken.”

    that’s true. so, why not make up some new word for it then. worked for google, twitter etc… the least they could have done was throw an “i” in front of the name like the rest of the “new” yuppie crap out there.

  21. XenoPhage says:

    Is it just me, or does github not have a “hiphop-php” project? And the google group is empty… (though, as a new group, I guess it’s feasible noone has posted yet..)

  22. yuppicide says:

    Eitherway I think this is great news.

  23. Ode says:

    I still can’t find the source code to this damned thing.. seems more like vapourware to me.

  24. Ode says:

    What happened to facebook setting up XMPP/jabber? only mentioned briefly in a blog post and then nothing.

  25. Spork says:

    They wanted to do that, but iHop was already taken.

    Exactly. PHP has never done wrong by me, and is plenty fast for my quantity of web traffic.

    I wish someone would rewrite the java runtime…

  26. Mutant says:

    No comment on Facebook’s performance, but I must say this project has caught my attention. I might try it out.

    People here saying that there isn’t much of a point to use this rather than plain ol’ PHP for something simple are indeed right, unless, your project involves data mining, which i would hope could be made significantly more efficient with HipHop. Then again.. i could be wrong. HipHop could be total shit and make PHP go all emo on me; slitting its wrists to avoid being so fail any longer.


  27. Skinner says:

    “the least they could have done was throw an “i” in front of the name like the rest of the “new” yuppie crap out there.”

    iHop wouldn’t sound right, lol

    not to mention you’d only get pancakes when you googled it.

  28. imanhp says:
  29. rick says:

    “so, why not make up some new word for it then. worked for google”

    I always assumed Google was a play on Googol.

    The word in that spelling has at least existed since 1913. :3

  30. Chris says:

    Am I the only one that has missed something really obvious here – why not just write the code in C++ in the first place to be sure it is optimized instead of relying on a converter to write it for you ????

  31. Tomas says:

    This is cool and I like the fact they’ve made it open source.

    Unfortunately I work at a company that makes facebook games and having spent the last year working with the facebook api, I can say they have a very different view of usability than the other 6 billion people on the planet. I can’t help but feel this thing probably has some of that facebook mentality in, which in my experience proves to be nothing but a hindrance.

  32. Frankendaddy says:

    Neat! This explains why I get errors almost every single I try to login to FB. Way to go guys…take something that works and “improve” it.

  33. Tatsh says:

    Just delete your account already. Social networking is such crap.

    They hide the delete button on purpose:

  34. T&P says:

    How is
    run PHP convert that to HTML
    convert PHP to C++ then run C++ then convert that to HTML

  35. Choscura says:

    I don’t trust anybody involved in facebook to make anything worthwhile.

  36. autobot says:

    @ Chris

    I agree, obviously Facebook had C++ developers working for them to create hiphop. I assume it is because the current PHP developers they employ would become useless, no one likes the bad publicity that comes with large corporate layoffs.

  37. mike says:

    T&P – Because in PHP, it goes: PHP script interpreted by PHP binary (C++) to convert to HTML.

    This skips the interpreter, and runs pure bytecode on the CPU.

  38. ian says:

    facebook is one of the largest contributors to the open source community, this is just another notch on their belt.

    with regards to why they wouldn’t hire c++ devs, web development is a very different skill with a large pool of talent. It is great they have found a way use that talent while leveraging the benefits of compiled code.

  39. T&P says:

    But the interpreter would still be needed for the PHP to C++ code then in 2 extra steps to be compiled and then assembled then its actually ran.

  40. SophT says:

    @dnm: but the ui and software is all junk. Just like PHP.

    PHP has a UI?


    I remember reading an article a few weeks ago with a Facebook employee (founder?) talking about how they were rewriting PHP to run as a compiled language.

    This seems more like they wrote their own C++ interpreter, instead of the PHP built-in interpreter, not a new language or a PHP re-write.

  41. James says:

    RE: writing the site directly in C++, I’d say it’s more an issue of library support and language syntax than anything else — think of Hiphop as being a set of C++ extensions (a “grammar”, really) that let you write web pages with active content, in a less-sucky way than e.g. stringing together a massive pile of sprintf’s.

    And from what I’ve seen, this is probably not going to be a big boon to most people. I don’t have the quote, but they’ve basically said “optimize your database, stand up memcached, look at your architecture” before you try to move to Hiphop. Most sites are not going to find their bottleneck in CPU-bound PHP processing as it stands, in which case making that part faster won’t improve the user experience.

  42. Chloe says:

    intersting post…. before I have noticed facebook is really a bit slow… and now its much faster…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,705 other followers