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.

42 thoughts on “PHP Runtime Rewritten, By Facebook?

  1. 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.

  2. 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

  3. 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).

  4. 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.

  5. “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

  6. “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…

  7. @ 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.

  8. @walt
    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…

  9. 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.


  10. @walt
    “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.

  11. 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 ????

  12. 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.

  13. @ 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.

  14. 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.

  15. @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.

  16. 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.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.