top of page

How does the Runtime Converter compare to Facebook's HipHop?

On the face of it, HipHop, which is Facebook's source code converter from PHP into C++, would be a very similar project to the Runtime Converter which converts PHP into Java/Swift/C#. In fact, HipHop serves as an excellent example of how it is possible to convert PHP and have it run flawlessly.

Where HipHop and the Runtime Converter differ is in their primary goals. The primary goal of HipHop was to speed up PHP and reduce costs. The Runtime Converter also has this potential, especially with the Swift and C# versions (and with developer work + optimization also the Java), but one of its main goals is to enable developer productivity using the new languages.

HipHop took relatively simple code such as

and converted it to completely unreadable code whose only goal is to be optimized by the g++ compiler.

HipHop conversion:

Now, this code may not be radically different than the way C++ really looks, but it is completely useless for development and intended to be that way.

Here is that same block of code put throught the Runtime Converter into Java:

This code far from perfect, but it is important to keep in mind the bigger picture.

1. This code is easily converted into basic Java with a few keyboard strokes.

2. The Runtime Converter is being optimized to run correctly and to compile first, and this overly simple loop example is not all that it can handle. The redundant isTrue check will also be shortly removed.

3. When you call this function from Java, it really doesn't matter what its internals are, just that it works.

Here's another example from code from a PHP CURL example (http://php.net/manual/en/curl.examples.php).

PHP

Converted Code

Of course its still a work in progress and we'll remove the hardcoded option values in the future, but it really does work and it is not significantly more verbose than the sources themselves. This example, btw, happens to be not a function, but an "include". It would be similar to a " void main(String[] args)" or servlet GET. With the Runtime Converter, you can actually load this example to a server or call it on the command line. More Information about HipHop

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page