Facebook Writes PHP Compiler (Update)

nav_first.pngFirst: blog:more-than-just-a-wiki
More than just a Wiki
Edited: 07 Jul 2009 07:57 by: pieterh
Comments: 2
Tags: who-watches-the-watchers

nav_prev.pngPrevious: blog:css-package-competition-results-finally
CSS Package Competition Results Finally!
Edited: 02 Feb 2010 18:20 by: gerdami
Comments: 9
Tags: game-over

Last: blog:new-wikidot-office
Wikidot moves its office to Business Link Toruń
Edited: 24 Mar 2014 15:37 by: michal frackowiak
Comments: 3
Tags:
nav_last.png

Next: blog:private-categories-update
Private Categories: Update
Edited: 06 Feb 2010 10:14 by: pieterh
Comments: 17
Tags: public-in-private-in-public
nav_next.png

by pieterh
on 03 Feb 2010 09:05

Facebook's Haiping Zhao explains how he's been working for two years on way of making PHP run much faster. Facebook is now running that on 90% of their servers and they will release the source code this evening. This could be very interesting for Wikidot, since we use PHP and any improvement in performance would be great.

On his blog, Haiping Zhao explains that:

HipHop for PHP isn't technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP's runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

Converting PHP into C++ and then running the GNU g++ compiler is in effect creating a PHP compiler. For many years C++ was itself compiled like this, first converted into C and then that intermediate code compiled.

The limitations of this system are that PHP extensions will need to be rewritten, so most likely HipHop is today only going to work for simpler PHP applications (and Facebook itself). But releasing it as open source is a smart move. It means other teams — like us — will try it, extend it and improve it.

Comments: 0

Add a New Comment

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License