Skip to content

notes - froscon 2012 - alternative php runtimes - sebastian bergmann

Following are my notes to sebastians bergmann presentation. The presentation was quite good (you can add "as usual" if you have seen sebastian bergmann more than once :-)).

#120825 sebastian bergmann

_general - he found at least 10, some ready for production - php core is threadsafe, problems are linked in extensions

_php - bytecode-based interpreter (interpiler) - php->php-bytecode->execution - "the" (official) implementation of the php language ->currently no official specification exists

phpruntime - token base - reads file character by character (scanner) - tries to figure out what to do with the words (parser) ->compilekit shows you how your code looks when it is compiled as bytecode - bytecode is is not optimized

_hiphop (only productive alternative) - tries to save power (cpu usage) and also speed up "some things" ->main reason is saving powercosts

  • php->c++->native binary
  • reimplementation of the php runtime (with common extensions) in c++
    • like filesystem, mysql (what they need to run facebook)
    • compiling takes long (very long)
    • sebastian compield phpunit for hiphop
    • faster from factor 1 to 3
    • compiling takes up to factor 65 more time on hip hop but scalls very well with cores
      • CodeError.js (hphp -> tool to transform them in xml or whatever for continious integration)
    • binaries became very large (facebook uses bittorrent for deploing) ->thats why they implement the HipHopInterpreter (factor 2 slower than php) ->shares library of hip hop but is based on php
    • optimize code by compiling
    • tries to figure out the type your variables (to set native c++ types where possible)
      • significant smaller footprint by good code
    • php unit works (with all features)
      • you have to compile your code plus php unit code plus your test code

sebastian knows two companies that are working with hiphop.

_hippyVm - php interpreter implemented using PyPy - faceboog sponsored study by 1 person and 2 months - get as close to php as possible - is it feasible to implement a php runtime using PyPy ->it is possible to implement 80 percent of php in 20 percent of the time

_DaVinci Machine Project (MLVM) - Multi-Language renaissance for the JVM - First-Class Architectural support for languages other than java - Facebook is working on (or at least thinking about) PHP on MLVM - Isn't the first (and not the last) php runtime implementation on jvm

_HappyJIT - academic investigation - PHP Interpreter implemented using PyPY - PHP->Zend Parser->PHP Bytecode->APC->BcParser->HappyJIT Bytecode - tries to optimize php bytecode - they have to use APC to get the bytecode

_php.js - php interpreter implemented in java script - same 80/20 rule

_phalanger - php->common intermediate language (CIL - microsoft .net code) - rewrite underway to leverage the dynamic language runtile (dlr) - started as reasearch projcet

_php compiler (phc) - academic investigation - php->native binary - static analysis: abstract syntax tree in xml

_rose ( - framework for source-to-source transformation and static analysis - strated at a military laboratory - php support based on phc - php->AST in PHP XML->

_Roadsend PHP - PHP->Native binary - No longer maintained

_Roadsend PHP: Raven (RPHP) (available on github) - Based on LLVM, C++ Runtime - Reuses code from phc

_Pipp - php->parrot bytecode - looks dead

_Quercus - Implementation of php 100% in java

_ibm webspheare smash ( - php->java bytecode - c-level php extensions can be used via the nava native interface - support for DBGp debugging protocol

_talaria runtime ( - currently in private beta - claims 10 times faster - clains support for real-world applications such as drupal and wordpress - currently no information in what they implement php

_trade-off - use all or some php features - time to implement vs runtime


//reflectionApi practical php reflection | how to use php reflection api | Die Reflection Api