Facebook uses a lot of PHP, and given the scale of the service, they must be watching performance very closely.
Bandwidth and infrastructure will be their main costs, so it makes economic sense to try to run as much of Facebook on as little infrastructure as possible.
And one of their tools they have announced this week: HipHop
HipHop is a toolchain that preprocesses PHP into C++, which can subsequently be compiled by a C compiler, and then used with their webservers. Facebook says they are seeing a 50% increase in performance.
This is beautiful engineering: they can now run double the load on the same infrastructure.
Evangelists always cleam that dynamic (or interpreted) languages are a win-win.
You win on ease of use, as a dynamic language is easier to program for, easier to debug and easier to maintain.
And you supposedly win on performance, as they run as quick as compiled code.
The latter is never true in practice, no matter what complicated theoretical explanation they always give to say it really is so.
There are numerous real world examples:
- Google wants you to use a Java-like on Android Phones, but if you want it to go fast, use C and compile to binary. (a brilliant video to drive the point home here). Java is not fast, using it on a small phone cpu is a challenge.
- Windows Vista contained a lot of .NET during development, but that was ripped out and changed to native x86 for speed reasons.
- Using PHP based Wordpress for a large site is only really doable when you use static caching, and do not run PHP at all for most of the requests.
A lot of the evangelism for dynamic (and interpreted) languages is like marketing propaganda; they sell you a dream, but a lot of dreams do not survive a confrontation with reality.
The fastest and most efficient way to run code is to use the least amount of the best instructions for a given cpu.
Speed matters in the real world.