orlandopozo.com
Log
  •  
    04 Feb '10
    3:27:00 PM (PST)
  1. Facebook and Rasmus Lerdorf on HipHop for PHP

    In summary:

    One common way to address these inefficiencies is to rewrite the more complex parts of your PHP application directly in C++ as PHP Extensions. This largely transforms PHP into a glue language between your front end HTML and application logic in C++. From a technical perspective this works well, but drastically reduces the number of engineers who are able to work on your entire application. Learning C++ is only the first step to writing PHP Extensions, the second is understanding the Zend APIs. Given that our engineering team is relatively small — there are over one million users to every engineer — we can’t afford to make parts of our codebase less accessible than others.

    http://bit.ly/d7V7y2

    Calling the code translator “a nifty trick,” Lerdorf worries that some developers will see HipHop as “some kind of magic bullet” for site performance.

    Speeding up one of the faster parts of your system isn’t going to give you anywhere near as much of a benefit as speeding up, or eliminating, one of the slower parts of your overall system. If on every request you are hitting memcache/postgresql/mysql 10 times and spending a lot of time in system calls, don’t expect miracles from HipHop.

    Lerdorf ended by suggesting Yahoo’s YSlow and Google’s Page Speed for analyzing front-end issues, and he recommended Valgrind’s Callgrind for low-level back-end profiling and XDebug for userspace PHP profiling.

    http://bit.ly/ahaLZZ

    Anyone who knows me knows that I am a big fan of nifty tricks that solve the problem. When I first heard about the Facebook effort I was assuming they were writing a JIT based on LLVM V8 or something along those lines. Writing a good JIT is hard. Doing static code analysis and generating compilable C++ from it is indeed a nifty trick. It’s not “just” a nifty trick, it is a cool trick that takes advantage of a number of characteristics of PHP

    If you have done your homework and find that your web servers are cpu-bound, you are already using an opcode cache like APC and your Callgrind callgraph shows you that the PHP executor is a significant bottleneck, then HipHop PHP is definitely something you should be looking at.

    http://bit.ly/aXfKSQ