Hacker News new | ask | show | jobs
by StudlyCaps 4251 days ago
I don't have a Facebook account so I can't post a question. Can someone post this question for me? Ask Zuck why he's invested so much money into making their own frankenstein PHP when they could have just used Java? I mean I like PHP and all. It's great for blogs or personal websites, but why would you invest all of that blood, sweat and beers into build something at that scale on PHP?
2 comments

By the time they got around to building "frankenstein PHP", it was way too late to switch languages. Before that, there was no time to switch.

The whole development process of Hack is interesting. It was very organic, if the stories I heard were true. Someone got it in their head to try compiling php to c++; they tested it and got a free 20% (ballpark) speedup of everything. Then they made a VM to make it faster and more efficient, and once they had that vm, it was easy to add small, useful features like 'await' and such.

Much of what people hate about PHP isn't in Hack, by the way. It has type hinting, lots of dumb conversions don't happen, and obviously it's not interpreted. Hack is really just a better language they made that, because it shares the same syntax as PHP, was very easy to switch over to while still developing features.

Well, at some point Facebook had a code base with a whole bunch of PHP and it was worth a lot of effort to make it more efficient. One possibility was rewriting stuff, one possibility was this project to make a different PHP compiler. It wasn't obvious what the right strategy was and the Facebook spirit is to try lots of stuff and see what works. So effort went into each, and basically each of the methods turned out worthwhile for some things. Nowadays a lot of components of Facebook are not written in PHP, especially the infrastructural components. But a lot are written in PHP and work goes into the compiler. So the answer is, it didn't happen dogmatically, it happened bit by bit.