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 (rosecompiler.org) - 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 (projectzero.org/php) - php->java bytecode - c-level php extensions can be used via the nava native interface - support for DBGp debugging protocol

_talaria runtime (talariatech.com) - 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

slides talks.thephp.cc

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

tool - alternative to winmerge for linux - make a visual diff of two files

If you are searching for an alternative of winmerge that works quit fine on linux and other operation systems, take a look to meld. This tool provides you the ability to make a well visual diff from two files (preferred text files ;-)). It supports tabs, so you can diff multiple files. It is fast and it looks like the memory footprint is quite nice and small. By the way, merge also supports the main version control systems git, svn etc.

web - Ubisoft Chef Yves Guillemot "93 bis 95 Prozent Schwarzkopien auf PC"

Schon seit einigen Jahren gehört Ubisoft zu den Publishern, die relativ hart mit PC-Spielern umgehen: Angepasste Versionen von Blockbustern wie Assassin's Creed und Splinter Cell kommen deutlich später als die Konsolenfassungen, dazu kam früh ein Kopierschutz mit Always-Online-Zwang - mit dem sich das Unternehmen allerdings unter anderem wegen technischer Probleme unbeliebt gemacht hat. Im Interview mit Gamesindustry.biz erklärt Firmenchef Yves Guillemot jetzt einige Hintergründe. So schätzt er, dass "auf PC gerade mal fünf bis sieben Prozent überhaupt bezahlen, der Rest raubkopiert", was dann zu einem Anteil von "93 bis 95 Prozent von Schwarzkopien" führt, wie Guillemot bekräftigt. [...]
Quelle

Alleine bei der Überschrift fragt man sich schon mit welchen "Studie" er zu dieser Einschätzung kam. Schaue ich ein wenig unscharf in die Welt, würde ich eine Zahl von 10 bis 20 Prozent angeben. Die meisten Menschen, die kein Geld haben, sind mit den Betriebssystemspielen zufrieden (zumal denen auch die nötige Hardware fehlt). Macht die "Studie" diese Zahl an einer Anzahl von heruntergeladenen "No-CD-Cracks" fest, kann man nur anmerken, dass man dies auch als Käufter macht. Eine Gängelung an das Internet oder an das Trägermedium ist kundenunfreundlich. Man fragt sich dabei das selbe, wie wenn man einen Kinofilm auf einem Trägermedium erworben hat und die ersten fünf Minuten mit Warnhinweisen oder Vorschaufilmen belästigt wird. Da schaut man schon neidisch zu den Menschen, die "Grauzonenfilme" besitzen, dort startet der Film sofort. Auch der Fall, dass die Schlüsselserver, die man zum Teil benötigt um ein Produkt zu starten/installieren, werden sehr zeitnah abgeschaltet. Da steht der Kunde auf verlorgenen Posten.

howto - mysql delete from table as t

You try something like

DELETE FROM `my_table` AS `t` WHERE ...
and you get back an error. The problem is, that you are using an alias for your table and mysql can not figure out where to delete from. The solution/fix is simple
DELETE `t` FROM `my_table` AS `t` WHERE ...
. I found the answere here