Home CONFIRMED: Facebook Gets Faster, Debuts Homegrown PHP Compiler [Update]

CONFIRMED: Facebook Gets Faster, Debuts Homegrown PHP Compiler [Update]

The rumors have been flying over what’s going on over at Facebook headquarters. The word has been that a PHP team was brought in and made to sign non-disclosure agreements before discussing a PHP project that has been in development for the past two years. Alex Handy, senior editor of the Software Development Times Blog, predicted last Saturday that Facebook “has rewritten the PHP runtime from scratch,” and several sources have confirmed for us tonight that Facebook has indeed been making some changes to the basic PHP runtime environment.

According to our sources, Facebook has been working on a PHP compiler that will
increase speed by around 80% and offer a just-in-time (JIT) compilation engine that will offer a number of advantages. The project is very similar to Google’s Unladen Swallow project, which rebuilt the Python compiler, boosting the speed fivefold and opening the door for multi-language integration.

Update: Facebook officially announced the project, titled HipHop, this morning and confirmed that it would be released as open source this evening. Facebook will be hosting a talk at 7:30 PST with PHP developers to get into the specifics. The talk will be streamed live on Ustream. Developers are encouraged to comment on RWW’s open thread discussing the implications of the PHP runtime rewrite.

Richard Crowley, an engineer at OpenDNS who is familiar with the project, told us that David Recordon, an engineer at Facebook, invited him to come to Facebook’s headquarters Tuesday morning but wouldn’t give a reason. Crowley mused to us that it was likely his PHP skills and personal connections that got him through the doors and clued us in on what he thinks will be going on behind them.

PHP is normally an interpreted language, which means that every time a user accesses a PHP page, the server needs to take the code and interpret it to produce the final product. A compiler, however, makes this process much quicker, as the code is interpreted before the user ever asks for the page. The problem here is that any time that page needs to be changed, the code needs to be recompiled.

Crowley explained to us that the JIT compiler Facebook is introducing occupies a middle ground that not only retains the flexibility of PHP as an interpreted language, but offers the speed of compiled languages like C.

“Compiling PHP to code a CPU can directly execute certainly has performance implications. It would be silly to alter the workflow to be more like C or C++ by doing all parsing and compilation ahead of time. At the other end of the spectrum, it’s slow and out-of-fashion to interpret every statement within the runtime. A JIT (Just In Time) compiler compiles frequently-executed portions of the program to machine code for speed while maintaining the flexibility of interpreted code.”

Essentially, the closer a coding language comes to bare metal, the faster the program will run. Facebook’s programs are reported to run around 80% faster than before now that the runtime – the code-compiler-program sequence – has been restructured and rewritten.

Crowley continued, saying that he expected Facebook to announce a JIT compiler based on the Low Level Virtual Machine, which lays at the heart of Google’s Unladen Swallow project. Crowley’s suppositions were confirmed by anonymous sources tonight.

When we asked what he thought of this style of release – years of secretive development by two lonely coders, likely locked in a deep, dark vault – Crowley said it was typical.

“[Facebook] tends to do giant code dumps,” he said. “Facebook tends to build something big, use it, and open source it.”

We wish Facebook had made this project open, as we’re sure many PHP developers would concur that the efforts would have been much swifter and more beneficial to the public had more folks and a larger team been involved from the outset. And we do wonder about possible duplication of effort from others who may have been working on the same issue.

There are a number of us out here running PHP (ahem!) that could certainly have benefited from the speed boost.

Nonetheless, we’re looking forward to seeing what this does for our PHP browsing experience and how the open-source community reacts to the news. Will the community rally around the new compiler and push PHP into a new realm? Let us know your thoughts in the comments.

Update: In fact, it turns out that the PHP source code is getting translated first into C++ and then compiled with g++. While the details of the process are different, the end result is the same as are many of the implications. Jolie O’Dell wrote an update earlier today, explaining exactly how Facebook has altered PHP and we’ll be taking a look at some of the implications shortly.

Additional reporting for this story was also done by Jolie O’Dell.

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.