Facebook Compiling PHP to Run on the JVM?

Notice: Undefined property: stdClass::$non_show_posts in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 48

Notice: Undefined property: stdClass::$aga_c234x60 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 29

Notice: Undefined property: stdClass::$aga_c728x90 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 31

Notice: Undefined property: stdClass::$aga_c120x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 32

Notice: Undefined property: stdClass::$aga_c160x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 33

Notice: Undefined property: stdClass::$aga_c120x240 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 34

Notice: Undefined property: stdClass::$aga_c234x60 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 29

Notice: Undefined property: stdClass::$aga_c728x90 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 31

Notice: Undefined property: stdClass::$aga_c120x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 32

Notice: Undefined property: stdClass::$aga_c160x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 33

Notice: Undefined property: stdClass::$aga_c120x240 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 34

Notice: Undefined variable: content_end in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 166

An article popped up today claiming that Facebook is investigating compiling PHP to run on the JVM. Until now, Facebook has been using a PHP-to-C++ cross compiler. But the addition of invoke dynamic to Java seems to have opened up a new possibility for Facebook.

Alexander Turner, the author of this article points out that using the Multi Language VM for PHP is somewhat analogous to what V8 has done for JavaScript: JIT compilation of interpreted languages shows a significant increase in speed. In fact, Alexander sees this as the beginning of the end for interpreters:

These are exciting times. Soon I expect interpretors and interpreted langauges to be confined to DSLs and all general-purpose coding to be running in a JIT environment or as up-front compilation. That will be good for companies, good for performance and good for the planet.

Either way, it’s good to see another of the major companies taking the JVM seriously. It could certainly take a long time for Facebook to get to a stage where they can have their code running on a VM unless they leverage the Quercus or Project Zero implementations.

Unknown is whether this is actually happening, but it brings up an interesting debate. If you had a Facebook-size codebase written in PHP, would you take this approach? Node.js would certainly be a more fashionable alternative.