1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

Facebook's HipHop Can Now Build Grimstad

Phoronix

Published on 08 May 2011 10:00 AM EDT
Written by Michael Larabel in Phoronix
5 Comments

Announced to the public last year by Facebook was HipHop, an open-source project that transforms PHP code into highly-optimized C++ and then uses the GCC C++ compiler to produce a native system binary. Facebook's original numbers showed that by using this transformer/compiler on their servers the CPU usage went down by about 50% and they were able to supply around 70% more traffic on existing resources since the PHP code is no longer being dynamically interpreted. Here's a look at Facebook's HipHop during some of our first tests.

Facebook developed HipHop so they could continue writing the core of Facebook's code in PHP as a scripting language without reverting to writing C/C++ extensions to PHP, which would mean hooking into Zend APIs and much more of a burden to their engineers. Facebook had also rewritten parts of PHP's Zend engine for increased performance, but that didn't lead to the performance benefits they were after. In the end, they wrote HipHop to transform PHP source code into C++ and then to build it under GCC.

The idea itself isn't original as the largely defunct Roadsend PHP / Roadsend Raven project had a similar goal of producing highly-optimized native system binaries and various other features, but it was leveraging the Low-Level Virtual Machine rather than GCC.

When Facebook's HipHop work was publicly announced in February of 2010 it received some attention by the media and others for "turbo charging PHP", but since then there hasn't been too much public interest that we've seen. However, a side project of mine for the past number of weeks has been to get Facebook's HipHop successfully building and running the Phoronix Test Suite. In particular, the Phoronix Test Suite 3.2-Grimstad code. Today it's successful in doing so.

While the Phoronix Test Suite is unique in that it's a widely-used non-server software package that's written in PHP as opposed to C/C++, Python, or even Java, PHP has worked out very well with the Phoronix Test Suite for its purposes. The quest to get the Phoronix Test Suite working under HipHop though hasn't been for any performance reasons, since pts-core (the Phoronix Test Suite engine) is rather light and not demanding at all: it's the actual test profiles being executed as the benchmark that's what's more taxing on the system. The Phoronix Test Suite just manages the test installation, execution, and the results.

So why even bother with building the Phoronix Test Suite client under HipHop? It's been a low priority task for a few reasons: there's been some that don't like PHP (or can't have it installed) on their systems, there's some environments where PHP can be troublesome to get running (such as some embedded/mobile cases), there may be some performance benefits to running the Phoronix Test Suite server code and the bilde_renderer / pts_Graph components of OpenBenchmarking.org, and it's just a research experiment.

Right now though Facebook's HipHop is limited to Linux x86_64 support, so it doesn't do much good for bringing the Phoronix Test Suite client to any new platforms where PHP is not already supported. It would be nice to produce native system binaries for ARM, but there's no sign of that support coming to HipHop soon or until Facebook begins evaluating a roll-out of any ARM servers. So right now this initial HipHop upbringing is more about an experiment and seeing if there would be any performance gains to the OpenBenchmarking.org server infrastructure as its features and capabilities become enriched.

Facebook's HipHop Can Now Build Grimstad


While HipHop seeks to implement the entire PHP language, it wasn't the most straightforward process to build all of the Phoronix Test Suite (pts-core, bilde_renderer, pts_Graph, nye_Xml, etc) under HipHop. At this time Facebook is targeting PHP 5.2 transformations via HipHop while PHP 5.3 is out on the horizon. That's good enough for the Phoronix Test Suite as it will run fine going back to early PHP 5.1.x builds, but there's some functions (e.g. the eval() call) and other items that HipHop doesn't yet implement.

At the same time, there's a few areas where HipHop's transformation of the PHP code to C++ is less than ideal. As a result, a few areas of the Phoronix Test Suite code were reworked and cleaned up in the process so that it can be more efficiently and directly translated to C++. This work is living in Git master for Phoronix Test Suite 3.2-Grimstad. The latest code on Phorogit as of today (8 May) should successfully build and work with the latest HipHop code. This work will also be found with Phoronix Test Suite 3.2 Milestone 3 to be released in the near future. Documentation on how to build the Phoronix Test Suite with Facebook's HipHop will also be included. To those who don't care about HipHop, the Phoronix Test Suite will continue to work in its current form, as always. This is just an optional way for those who may want to run the Phoronix Test Suite as a native system binary.

For those curious about HipHop, here's some statistics. In its normal form, the Phoronix Test Suite is distributed as a 416kb .tar.gz package made up of roughly 38,709 lines of PHP code. When compiled under the latest HipHop / GCC 4.4.5 on Ubuntu 10.10 x86_64, the generated Phoronix Test Suite program binary is 33.7MB in size. The HipHop transformation from PHP to C++ turns the 38,709 lines of code into 161,028 lines of C++ code that is 6.8MB in raw form with another 20,339 lines of header files.

More information about Facebook's HipHop open-source project can be learned from its GitHub page.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. AMD R600g/RadeonSI Performance On Linux 3.16 With Mesa 10.3-devel
  2. Intel Pentium G3258 On Linux
  3. SilverStone Precision PS10
  4. ASRock Z97 Extreme6
Latest Linux Articles
  1. KVM Benchmarks On Ubuntu 14.10
  2. X.Org Server 1.16 Officially Released With Terrific Features
  3. Ubuntu With Linux 3.16 Smashes OS X 10.9.4 On The MacBook Air
  4. Preview: Benchmarking CentOS 7.0 & Scientific Linux 7.0
Latest Linux News
  1. Unigine Develops City Traffic System, A Driving Simulator
  2. Intel 3.0 X.Org Driver Still Baking, New Development Release
  3. Eric Anholt Makes Progress With Broadcom VC4 Graphics Driver
  4. Intel Is Getting Very Close To OpenGL 4.0/4.1/4.2 Mesa Support
  5. Valve Is Still Hiring For SteamOS, Linux Work
  6. Users Warned About Possible Regressions With DRI3
  7. GNOME Shell Gets Wayland HiDPI Fonts, Mutter Gets Touch Gestures
  8. BPTC Texture Compression Comes To Nouveau After Intel's Work
  9. Development Continues For Supporting EXT4 On NVDIMMs
  10. Libinput 0.5 Improves Pointer Acceleration, Adds A Configuration API
Latest Forum Discussions
  1. Updated and Optimized Ubuntu Free Graphics Drivers
  2. Radeon related kernel bug??
  3. AMD Publishes Open-Source Linux HSA Kernel Driver
  4. Next-Gen OpenGL To Be Announced Next Month
  5. Open-Source Radeon Performance Boosted By Linux 3.16
  6. Remote gui not accessible in Phoronix Test Suite 5.2
  7. AMD "Hawaii" Open-Source GPU Acceleration Still Not Working Right
  8. In Road To Qt, Audacious Switches From GTK3 Back To GTK2