Slashdot Mirror


Facebook Rewrites PHP Runtime For Speed

VonGuard writes "Facebook has gotten fed up with the speed of PHP. The company has been working on a skunkworks project to rewrite the PHP runtime, and on Tuesday of this week, they will be announcing the availability of their new PHP runtime as an open source project. The rumor around this began last week when the Facebook team invited some of the core PHP contributors to their campus to discuss some new open source project. I've written up everything I know about this story on the SD Times Blog."

12 of 295 comments (clear)

  1. is this being used now? by Anonymous Coward · · Score: 5, Funny

    Is this what they're using on the newly redesigned site? Because if so, it's pathetically slow. Facebook is one of those places that with every attempt to "improve" things somehow manages to make it worse and worse. They're a perfect candidate for a Microsoft buyout.

    1. Re:is this being used now? by Daengbo · · Score: 5, Informative

      Try the "Lite" version. It's much faster, and doesn't have that annoying chat bar.

  2. Screw PHP, I write everything in C by Anonymous Coward · · Score: 5, Funny

    PHP is for lazy developers. I develop my webapps in C and I even wrote my own httpd to improve performance.

    1. Re:Screw PHP, I write everything in C by biryokumaru · · Score: 5, Funny

      Servers are for lazy developers. I develop my webapps in my head and I even deliver the pages manually to improve performance.

      --
      When you're afraid to download music illegally in your own home, then the terrorists have won!
    2. Re:Screw PHP, I write everything in C by Anonymous Coward · · Score: 5, Funny

      Webapps are for lazy developers. I sip my coffee, causing a multiply entangled photon to collapse and resolve the location of countless electrons throughout the universe, spurring various exotic species of butterflies to flap their wings a twitch differently, which in turn subtly alters the flow of the viscid gaseous matter in Earth and various other planets, affecting the touch organs of living matter that can feel moving fluid, which messenger or nervous impulses relay to their minds, creating customer-tailored web content for my clients.

  3. High performance in scripting languages? by BadAnalogyGuy · · Score: 5, Insightful

    At some point, if you are lucky enough, you will require extremely high performance from your web pages. You start out coding HTML in Notepad and move on to Perl CGI then on to PHP with scripting embedded right in the generated HTML. All the time you gain programming crutches at the expense of processing speed, and for a while this is a great tradeoff.

    But one day you start having server hiccups because your scripts can't keep up with your traffic. Sites like Amazon have already run into this and have moved away from scripting languages and back to system languages. Running applications directly on the CPU instead of relying on a runtime to translate (at best) bytecode into machine instructions means maximizing CPU cycles.

    So I wonder what longterm benefit there is in improving the language runtime.

    1. Re:High performance in scripting languages? by sakdoctor · · Score: 5, Insightful

      1. Static HTML
      2. PHP
      3. ???
      4. Rewrite the PHP runtime

      Truth is, that step 3 involves a whole load of steps where 90% of the problem will be database bound. Complied languages are not going to the magic solution in a real world situation.

  4. Assembler is High Performance by Murdoch5 · · Score: 5, Funny

    Don't starting talking about high performance and then naming languages that don't have the chance to deliver. What you really need to do is just program the entire web page in Assembler and then your going to have speed and performance that can't get any faster. If your developers are noobs and can't use real languages and there just Object Oriented kids who can't work on memory and need to access everything through abstracted methods, then fire them and get in some embedded developer who know speed = good code and good languages. If you don't want to use assembler then use good old C!

    You want speed use languages that can deliver and don't try to rewrite slow scripting languages to do the job of the trusted old methods, assembler and C.

  5. Misleading Summary (surprise!) by Anonymous Coward · · Score: 5, Informative

    From TFA: UPDATE: After sifting through the comments here and elsewhere, I'm inclined to agree with the folks who are saying that Facebook will be introducing some sort of compiler for PHP.

    Not a fork. Not as newsworthy as implied.

  6. Was revealed 3 weeks ago by insider by diretalk · · Score: 5, Informative

    This PHP compiler item was revealed three weeks ago by a Facebook employee. Read at http://therumpus.net/2010/01/conversations-about-the-internet-5-anonymous-facebook-employee/?full=yes

  7. Three sources of scripting language inefficiency by tepples · · Score: 5, Insightful

    I don't know what the fascination is with scripting languages on the Linux platform or with FOSS in general, but it results in slow programs

    Speed of development is faster in a scripting language, and in developed countries, below a certain scale, throwing hardware at it is cheaper than throwing programmers at it. The point of the article is that Facebook is above that scale, and programmers to write a new PHP interpreter have become cheaper than adding hardware+power+cooling.

    with flaky UIs.

    Citation needed. True, the often use a different widget set from the rest of the desktop (e.g. Tk from Tcl and Python and Swing from Java), but the popular widget sets also have scripting language bindings. how can one really tell the difference between a wxWidgets or GTK app written with Python vs. C++?

    I like to use refurbished/recycled machines; which means that I'll have an old P4, 512M RAM and a slow bus.

    Do these use more electric power than, say, an Acer Aspire Revo? The power consumption of a Pentium 4 and the power to remove the heat it generates can become an issue, especially for a server that's turned on 24/7.

    Many times, applications written in a scripting language, whether it be Perl, Python, PHP, or whatever, will hang often and then start working.

    There are three causes for this, and you can distinguish them with 'top' or 'Task Manager' or something else that can count CPU time and page file accesses:

    • Swapping: More dynamic languages tend to use more general data types, which incur memory overhead. For instance, they might use UTF-16 strings instead of 8-bit strings with an assumed encoding. Or they might use double-precision floating point instead of short integers for large arrays. This might cause a program to run out of RAM and fail over to the disk more often.
    • Garbage collection: This covers ways of determining which resources are no longer in use by any active part of the program. Python, Objective-C, and lately C++ primarily use an incremental garbage collection method called reference counting, which keeps track of the number of things that "know about" an object. But some other language interpreters use only tracing garbage collection, which in the naive form causes the application to pause and make a list of all live objects once memory allocations exceed some amount. This will cause a CPU spike.
    • Blocking: A lot of the APIs available to programs in scripting languages don't have well-known non-blocking versions. For example, a host name lookup might freeze the program until it finishes. The only way to work around these is to start a thread. This will cause a pause with 0 CPU and 0 disk.
  8. Assembler? Really? by Atmchicago · · Score: 5, Interesting

    Assembly language isn't platform-independent. It's really easy to screw up and hard to optimize. And it's not much faster than C/C++. The issue at hand is balancing the cost of writing the code with the cost of running it. I don't see how the cost of writing and maintaining software in assembly language will ever compete with the costs of C/C++, potential speed increases and all. Object-oriented languages make small performance sacrifices in return for much greater maintenance, and that's how it should be. Scripting languages take this even further, and for these large websites have lost their advantage. The only time assembly will prevail is when we return to incredible memory constraints, but even embedded systems pack tons of memory now so I don't see that being an issue.

    --

    You can lead a horse to water, but you can't make it dissolve.