3 ms·
Facebook was running a C++ based PHP interpreter, I'd say that's Web programming in an extreme capacity.
by nicholassmith 13y ago
Facebook was running a C++ based PHP interpreter, I'd say that's Web programming in an extreme capacity.
- cgag 13y agoThat sounds like saying assembly is well suited to web programming because Ruby compile down to it eventually.
- CCs 13y agoNot exactly. Now about half of the Facebook developers use C++ (the other half PHP)
- betterunix 13y agoIs that the rest of some technical feature or set of features, or just that most college graduates can be expected to have some minimal competency with C++ coupled with the fact that the PHP interpreter was written in C? I am inclined to think this is more a pragmatic decision than a technically motivated one.
- CCs 13y agoIt was technically motivated: https://developers.facebook.com/blog/post/2010/02/02/hiphop-for-php--move-fast/ https://developers.facebook.com/blog/post/2010/02/02/hiphop-... https://github.com/facebook/hiphop-php/wiki https://github.com/facebook/hiphop-php/wiki https://www.facebook.com/notes/facebook-engineering/folly-the-facebook-open-source-library/10150864656793920 https://www.facebook.com/notes/facebook-engineering/folly-th... Edit: From the 1st link "[...] I started my first piece of code transforming PHP into C++. The languages are fairly similar syntactically and C++ drastically outperforms PHP when it comes to both CPU and memory usage."
- betterunix 13y agoIt sounds to me like they wrote a PHP compiler that leverages GCC's optimizer. I am not seeing the technical motivation to use C++ for that; it would have been just as good to just produce GIMPLE. It looks like C++ was just chosen because it is what the developers knew, which is not all that far off from what I said. (Edit: it is also worth pointing out that the motivation for this tool is to avoid having to write C++ code)
- kyllo 13y agoHipHop was originally just a source code converter. It basically took PHP source code and compiled it to C++ code. It's because they wanted to write in PHP but they needed C++ speed. But I don't think that's how it works anymore.