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?”
Leave a Reply
Please be kind and respectful to help make the comments section excellent. (Comment Policy)
Apostrophes. It’s okay to use them.
to bad facebook is STILL slower than any other site out there
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.
This could be interesting. I’d like to see something other than Facebook “translated”. But, yes… Facebook is still the slowest website around.
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?
Dan: I assume they mean the constant “Oops, something went wrong” messages you get when attempting to use the site.
The only problems with “Oops, something went wrong” that I ever see with Facebook is while using the games. Hardly facebook’s fault
its a part of their service no?
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.
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
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).
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.
@walt As with domains, all of the good names have been taken.
So, what you’re saying Walt, is, “Let’s keep it real” :p
damn my grammatical error!
“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
“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…
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.
Oh boy.. I love the smell of exploits in the morning.
@ 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.
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..)
Eitherway I think this is great news.
I still can’t find the source code to this damned thing.. seems more like vapourware to me.
What happened to facebook setting up XMPP/jabber? only mentioned briefly in a blog post and then nothing.
@walt
They wanted to do that, but iHop was already taken.
@M4CGYV3R
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…
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.
.____________.
@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.
http://github.com/facebook/hiphop-php
“so, why not make up some new word for it then. worked for google”
I always assumed Google was a play on Googol. http://en.wikipedia.org/wiki/Google_(disambiguation)
The word in that spelling has at least existed since 1913. :3
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 ????
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.
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.
Just delete your account already. Social networking is such crap.
They hide the delete button on purpose:
http://www.wikihow.com/Permanently-Delete-a-Facebook-Account
How is
run PHP convert that to HTML
to
convert PHP to C++ then run C++ then convert that to HTML
I don’t trust anybody involved in facebook to make anything worthwhile.
@ 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.
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.
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.
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.
@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.
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.
intersting post…. before I have noticed facebook is really a bit slow… and now its much faster…