Discussions

News: Facebook Releases HipHop JIT

  1. Facebook Releases HipHop JIT (8 messages)

    Facebook announced the HipHop for PHP runtime environment. HipHop provides JIT capabilities to PHP that supercede the traditional PHP runtime and provide better page rendering performance with lower CPU usage. HipHop helps to provide massive PHP scalability and optimal interfacing with Java, Python, and C++ back-ends. Rather than using a complicated HTML particle caching system, or source-level code transformations, Haiping Zhao of Facebook describes how HipHop works:
    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.
    The transformation process includes three main steps: 1. Static analysis where the system collects information on who declares what and dependencies 2. Type inference where it chooses the most specific type between C++ scalars, String, Array, classes, Object, and Variant 3. Code generation which for the most part is a direct correspondence from PHP statements and expressions to C++ statements and expressions. Overall HipHop allowed Facebook to keep the best aspects of PHP while taking advantage of the performance benefits of C++. In total, they have written over 300,000 lines of code and more than 5,000 unit tests. All of this is released on GitHub under the open source PHP license.

    Threaded Messages (8)

  2. Very nice work. But does it do all the operations (1. Static analysis, 2. Type inference 3. Code generation , 4. Compilation of C++ in binary ) at run time? Isn't a just-in-time compiler kick in at run time ?
  3. Very nice work. But does it do all the operations (1. Static analysis, 2. Type inference 3. Code generation , 4. Compilation of C++ in binary ) at run time?
    Isn't a just-in-time compiler kick in at run time ?
    Based on how PHP works, and how they extended it, this is effectively happening "at run-time". The operations are optimized upon page requests and the decision to run a PHP script through this process is automated. I think the most interesting part of this approach is that it entirely bypasses the "gold standard" of PHP performance engines, Zend. HipHop indicates that Facebook believes it's easier and more cost-effective to come up with this JIT setup than to try to tweak Zend into doing what they need. Cheers! E http://ciurana.eu
  4. JIT what?[ Go to top ]

    Awesome news! Wonder if Quercus is faster than HipHop? @Eugene Was the "JIT" part mentioned anywhere or did you just add it yourself? JIT stands for Just-In-Time, which is an adjective, not a noun, so it doesn't make any sense in this context. Also I don't see it mentioned anywhere else and it's not what is commonly understood as a just-in-time compiler as they are definitely doing the compilation ahead-of-time.
  5. P8[ Go to top ]

    Another solution for faster PHP code is P8, part of ProjectZero: http://www.projectzero.org/wiki/Development/PhpWebWhatPHP http://www.projectzero.org/php/
  6. Re: Facebook Releases HipHop JIT[ Go to top ]

    I wonder how the performance compares with Quercus?
  7. I wonder how the performance compares with Quercus?
    Indeed, I'm very curious about that too.
  8. Link is broken[ Go to top ]

    The github link provided above does not work ATM. This is the address of the discussion group: http://groups.google.com/group/hiphop-php-dev?pli=1
  9. No eval?[ Go to top ]

    Good work! I'm wondering if without eval() we won't loose some nice dynamic aspects of PHP. I can think of a few frameworks that would not work on HipHopJIT. What about reflection and references like $this->$$varName ?