Slashdot Mirror


Facebook Releases JIT PHP Compiler

angry tapir writes, quoting a Techworld article: "In its continuing endeavor to serve its 800 million users as quickly as possible, Facebook is once again revamping the way it handles its PHP-based Web pages. Facebook has posted ... its HipHop Virtual Machine (HHVM), which the company's engineers call a just-in-time PHP compiler. According to Facebook, this PHP execution engine is 60 percent faster than its current PHP interpreter and uses 90 percent less memory." Facebook has a weblog post with a more technical description.

244 comments

  1. First PHP post by PCM2 · · Score: 5, Funny

    I'd like to launch this discussion by making a snide remark about PHP.

    --
    Breakfast served all day!
    1. Re:First PHP post by Roachie · · Score: 2

      Yea, perhaps Facebook can now develop a tool for REAL programmers!

      --
      This sig is not paradoxical or ironic.
    2. Re:First PHP post by Anonymous Coward · · Score: 5, Funny

      Aren't Facebook programmers already tools?

    3. Re:First PHP post by MattW · · Score: 5, Funny

      It's too bad PHP doesn't scale.

    4. Re:First PHP post by rwa2 · · Score: 0

      Ha, yeah, every company I've ever worked for has been trying to bury PHP :-P This bodes not well.

    5. Re:First PHP post by garyebickford · · Score: 1

      Haha. :D

      --
      It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    6. Re:First PHP post by ohnocitizen · · Score: 2

      Great, along with all the other evils Facebook has perpetuated on the net, they've now made php more powerful and potentially more popular. They might as well give Darth Vader a perm.

    7. Re:First PHP post by man_of_mr_e · · Score: 2

      What's ironic is that if Facebooks development team spent half the amount of time they spend trying to make PHP perform well enough for them, writing code in a more conformant language.. they'd be done already.

    8. Re:First PHP post by Anonymous Coward · · Score: 0

      Sure it does, you just have to put some effort in to it

    9. Re:First PHP post by aztracker1 · · Score: 0

      I'm afraid on many levels I agree, and disagree. I personally abhor PHP. I dislike the more typical libraries (thin wrappers around C libraries) more than anything. There's no consistency, or uniformity in the most used APIs in the language either. Honestly, I would rather use NodeJS than PHP. I happen to use C# for my day job, and like MVC over WebForms (horrible model for web application building). That doesn't even get into other alternatives such as Rails, Django, etc.

      I really wish PHP would die a fast painless death already. It's the web equivalent of all the VB applications in the late 80's-90's.. though VB is actually a better language than PHP.

      --
      Michael J. Ryan - tracker1.info
    10. Re:First PHP post by jrumney · · Score: 1

      It's the web equivalent of all the VB applications in the late 80's-90's.. though VB is actually a better language than PHP.

      VB now, maybe. It might be going a bit far to say PHP is worse than the pre .NET VB that was used to write all those applications in the late 80's-90's though.

    11. Re:First PHP post by f0rk · · Score: 2, Insightful

      (as you are mod'ed Funny, I'm not entirely sure if your sarcastic or really unknowing)

      This is honestly one of the most idiotic and ignorant thing to say about PHP. PHP has it's quirks, and wierdnesses. But it's not any less of a language or platform then anything else.

      It did not have any special facilities or out-of-the-box features, prior to 5.3. But it has had FastCGI support for ages. It's honestly the only requirement you really want to scale PHP. You can deploy as many PHP workers as you like. Combined with a shared or replicated webroot and database, you have a really simple and SOLID scale path.

      Now when 5.3 is getting more and more deployed we also have PHP-FPM. A dedicated and officially supported process manager to pool and manage php workers. Just like FastCGI, it's architecture is super simple, and a blast to work with. One of the additions is "per pool php.ini", were you run the same instance of the manager but with entirely different PHP environments.

      Remember, the PHP philosophy has always been KISS, "Keep It Simple, Stupid". PHP in it self is just the language and runtime. Scaling is deliberately left outside of the core, and developed by people more skilled in that particular area. (Ok ok, its not entierly seperated from the core. PHP-FPM had some minor changes made to the 5.3 codebase to cater for their architecture).

    12. Re:First PHP post by icebraining · · Score: 2

      PHP is the opposite of a simple language. It was simple in the 3.X versions, but nowadays it has too much crap accrued. If you want a simple language, try Lua.

    13. Re:First PHP post by TheRaven64 · · Score: 2

      Or Smalltalk. And if you want Smalltalk to scale, VMWare bought Gemstone fairly recently and will sell you a deployment where you can have as many Smalltalk images as you want all using transactional memory to share state and happily scaling to a few million concurrent instances without any significant effort.

      --
      I am TheRaven on Soylent News
    14. Re:First PHP post by Eponymous+Hero · · Score: 1

      that's strange. i get resume requests through the zend certified yellow pages all the time. i can list tons of companies that are using php. here's a few for you.

      google.com
      yahoo.com
      youtube.com
      facebook.com
      wikipedia.org
      wordpress.com
      digg.com
      thepiratebay.org
      sourceforge.net

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
    15. Re:First PHP post by dave87656 · · Score: 1

      I don't know PHP, but it seems to have nine lives. It gets a lot of bad press but seems to be in use everywhere. And especially at high volume sites. Why is that?

    16. Re:First PHP post by takeya · · Score: 1

      Because when push comes to shove, it's easy to write, easy to make poorly thought-out patches and bugfixes to, and easy to set up and run.

      The main criticisms I hear of PHP are that it's "too easy" and lends itself to spaghetti code and security flaws.

      Being too easy means the market is saturated with PHP developers and it can be difficult, especially for HR, to decide who is actually a good programmer, and who is not.

    17. Re:First PHP post by dave87656 · · Score: 1

      It seems like high traffic sites like yahoo and facebook are using. Is there something about it which makes it well suited for that or are these cases of stuff that started small and grew way beyond anyone's wildest dreams?

  2. Yo Dawgs! by syousef · · Score: 3, Funny

    Da Hip Hop PHP compila is in Da House! Respect bitches!

    --
    These posts express my own personal views, not those of my employer
    1. Re:Yo Dawgs! by binarylarry · · Score: 3, Funny

      Yo dawg I heard you like PHP, so we put an optimizing JIT compiler in your PHP runtime, so you can execute PHP code while you execute PHP code!

      --
      Mod me down, my New Earth Global Warmingist friends!
    2. Re:Yo Dawgs! by syousef · · Score: 2, Funny

      Yo dawg I heard you like PHP, so we put an optimizing JIT compiler in your PHP runtime, so you can execute PHP code while you execute PHP code!

      Yo mama executes unoptimized PHP!

      --
      These posts express my own personal views, not those of my employer
    3. Re:Yo Dawgs! by MrEricSir · · Score: 5, Funny

      Yo dawg I heard you like interpreting PHP code, so we put an eval() function in PHP so you can interpret PHP while you interpret PHP!

      --
      There's no -1 for "I don't get it."
    4. Re:Yo Dawgs! by iluvcapra · · Score: 5, Funny

      Yo mama's so fat, she thinks strstr(needle, haystack) and strstr(haystack, needle) both sound delicious, she just can't ever remember which one is the one to use.

      Yo mama's so fat, she hides food in $a[1] and $a["1"].

      Yo mama's so fat, she silently coerces strings into sandwich, and when the interpreter complains, she puts an @ sign in front of it.

      --
      Don't blame me, I voted for Baltar.
    5. Re:Yo Dawgs! by Anonymous Coward · · Score: 0

      In Soviet Russia, PHP optimizes YOU!

    6. Re:Yo Dawgs! by mistiry · · Score: 1

      Shit, I forgot to log in. If you're gonna mod, mod this one, not my AC post.

    7. Re:Yo Dawgs! by MikeBabcock · · Score: 1

      Aw come on, do Python ;-)

      --
      - Michael T. Babcock (Yes, I blog)
    8. Re:Yo Dawgs! by iluvcapra · · Score: 1

      Wow that was a scare, this Mike Babcock is an associate of mine, though you appear to be a different one.

      Your mama's so fat, she doesn't indent with a tab, she indents with a Fanta.

      --
      Don't blame me, I voted for Baltar.
    9. Re:Yo Dawgs! by MikeBabcock · · Score: 1

      I am; although I've actually come across that one in vanity searches and wondered who he is :)

      --
      - Michael T. Babcock (Yes, I blog)
  3. Mixed feelings by Etz+Haim · · Score: 1

    That's a step forward for us who rely on crammed share hosting providers, but I strongly believe that PHP has to be phased out in favor of more recent techologies that enforce a clearer (eg DRY, separation of content and logic etc) way of thinking.

    1. Re:Mixed feelings by yelvington · · Score: 5, Insightful

      That's a step forward for us who rely on crammed share hosting providers, but I strongly believe that PHP has to be phased out in favor of more recent techologies that enforce a clearer (eg DRY, separation of content and logic etc) way of thinking.

      Programming languages don't create programming messes. People do.

    2. Re:Mixed feelings by Etz+Haim · · Score: 3, Insightful

      I was expecting this. You could argue that, and also add to it that there are PHP frameworks out there that do DRY, MVC etc. The problem is that PHP itself, by allowing "mixed mode" scripts containing both HTML and PHP, teaches a programming paradigm that is unacceptable by modern standards.

    3. Re:Mixed feelings by vinng86 · · Score: 5, Insightful

      You must be knew to programming. PHP is a language, not a framework. You can use a PHP framework to apply a MVC (model/view/controller) structure or you can choose not to. It's entirely up to the programmer, not the language.

    4. Re:Mixed feelings by John+Courtland · · Score: 4, Insightful
      Bullshit. PHP's standard library is a piece of shit that certainly promotes bad coding practices. Case in point: http://us3.php.net/manual/en/function.implode.php

      And I quote:

      implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    5. Re:Mixed feelings by InsightIn140Bytes · · Score: 4, Insightful

      No it doesn't. It's entirely up to you how you use an programming language. It's good that PHP supports "mixed mode" and everything between. Hell, I've made IRC server with PHP along with desktop apps and everything else.

    6. Re:Mixed feelings by CodeReign · · Score: 5, Funny

      You are a disgusting filth and I will loath the existence of people who don't use the right tool for the right job for the rest of my life.

    7. Re:Mixed feelings by Etz+Haim · · Score: 1

      My suggestion was that "mixed mode" scripts are per se incompatible with the MVC or DRY. It's a bad programming practice and if you use it, you are doomed to repeat yourself. Of course you can ditch it and create MVC frameworks like these that are already available. At this latter point you and I may agree.

    8. Re:Mixed feelings by Nerdfest · · Score: 1

      Programming languages don't create programming messes. People do.

      ... and PHP is one of their tools of choice.

    9. Re:Mixed feelings by Anonymous Coward · · Score: 5, Insightful

      Yeah cause PHP is so bad Facebook use it... no programming language is perfect, they all have their quirks. But your comment is baseless, PHP doesn't make bad programmers, it just doesn't break your legs if you are one.

    10. Re:Mixed feelings by InsightIn140Bytes · · Score: 5, Insightful

      You are a disgusting filth and I will loath the existence of people who don't use the right tool for the right job for the rest of my life.

      You know, people who do fancy stuff with not exactly the right tools were called "hackers".

    11. Re:Mixed feelings by binarylarry · · Score: 2

      Let me fix that for you:

      ...and PHP is the choice of tools!

      --
      Mod me down, my New Earth Global Warmingist friends!
    12. Re:Mixed feelings by Anonymous Coward · · Score: 0

      How can a six-digit-ID /.'er be so ignorant? Both implode() and explode() are perfectly consistent with one another. What's the problem?

    13. Re:Mixed feelings by MightyMartian · · Score: 5, Informative

      PHP is like BASIC. In the right hands it can certainly produce just as readable and maintainable code as any other language, but the short learning curve to get to first base invites people with little or no discipline, or often enough, without any underpinnings at all, to write absolute garbage. Worse, this code often ends up being the core of some important infrastructure, and then some poor yob (I was one for several months) has the unlucky job of trying to maintain this garbage. And because the php.ini file allows you turn on all the worst aspects of the language, you end up having to do just that just to keep the damned code running while you try to clean it up.

      Oh yes, and apart from the issues I have with the language itself, it has just a plain awful library, with inconsistencies throughout that mean I spend as much time perusing the docs as I do actually coding anything.

      Between these two factors, I have to say I hate PHP, but still find myself all too often being forced to deal with it.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    14. Re:Mixed feelings by MightyMartian · · Score: 4, Insightful

      Which means it won't be. PHP has taken hold, and good, bad or ugly, we're stuck with it. There's no phasing it in anything like the short or even medium term. LAMP is everywhere, and countless sites are built on it. It's like COBOL, a bad dream that will keep terrifying us even as better languages flicker and die.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    15. Re:Mixed feelings by John+Courtland · · Score: 1

      You're fucking kidding right?

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    16. Re:Mixed feelings by shutdown+-p+now · · Score: 3, Insightful

      You know, people who do fancy stuff with not exactly the right tools were called "hackers".

      Only when it's either hard to do so, or when doing that is some kind of a pun. When the only hallmark of such a work is that the result is a bloated mess...no, hacking doesn't have much to do with it.

    17. Re:Mixed feelings by shutdown+-p+now · · Score: 2

      Mixed mode is the least of PHP troubles as a language. It's things like silently converting strings to numbers when used as keys of associative arrays that really makes it so irksome .

    18. Re:Mixed feelings by garyebickford · · Score: 4, Insightful

      Ya know, about 30 years ago, that statement could have been written thusly:

      C programs are per se incompatible with the structured programming model. It's a bad programming practice and if you use it, you are doomed to repeat yourself.

      Your statement is pretty much equivalent to "never end a sentence with a preposition".

      Structured programming eventually failed to take over the world because it imposed too much artificial, restrictive structure. Back then I remarked that "structured programming" was merely a way to force all programs to fit on a flat two-dimensional surface with no crossing lines. Admittedly, such programs are easier to analyze, but are a tiny, tiny subset of the set of interesting and useful programs. For example, one can look at the entire internet as one rather large, complex, multithreaded program.

      MVC is a good model, but it ain't the be-all and end-all. All models are an attempt to impose an rational order on what is essentially a linguistic medium (with a veneer of logic). The languages that survive are those that allow the maximum flexibility, with enough support for the tools of analysis and good practice to allow programmers to succeed. C, for example, continues to succeed because it does not have such artificial constraints, but can be adapted to the constraints that the programmer (and the organization) considers important at the time. As a counterexample, see Pascal, or Algol. And don't forget Gõdel.

      So, use MVC and DRY. But one day you will find a situation where they get in the way of the most elegant solution. Or, more likely, they will get in the way of hacking a new feature into some legacy POS in time to meet the deadline that Marketing already promised to the client! :D

      --
      It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    19. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Of course it does. Then it's called an ugly hack.

    20. Re:Mixed feelings by LordLucless · · Score: 1

      more recent techologies that enforce a clearer (eg DRY, separation of content and logic etc) way of thinking.

      Yes, please give me more programming languages that enforce a way of thinking on me.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    21. Re:Mixed feelings by trawg · · Score: 5, Interesting

      I disagree that it promotes bad coding practices. I read that as a bit of a tongue-in-cheek comment that actually encourages people to use it the right way, while at the same time drawing attention to the fact that you can swap parameters and you might get unexpected results (i.e., the function working even though it should throw some sort of type error).

      Sometimes mistakes are made in libraries and terrible ugly hacks have to be made to work around them so as not to destroy many hours of work. Whether or not PHP has its share doesn't mean the blame for writing terrible code should be laid entirely at its doorstep.

      Certainly a few crappy library functions hasn't soured Facebook on PHP; I for one am glad to see their continued investment in it and - more importantly - their continued practice of open sourcing new and innovative ways of dealing with PHP.

    22. Re:Mixed feelings by Mad+Merlin · · Score: 2

      PHP is like BASIC. In the right hands it can certainly produce just as readable and maintainable code as any other language, but the short learning curve to get to first base invites people with little or no discipline, or often enough, without any underpinnings at all, to write absolute garbage.

      Would you you prefer that said people stumble their way through something more difficult like C, so that they can produce even worse code than they would have in PHP?

    23. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Thing being, with c, they would give up, and spend their time doing something else, like eating shrapnel.

    24. Re:Mixed feelings by Zero__Kelvin · · Score: 2

      "Programming languages don't create programming messes. People do."

      True; people who don't know how to design software and think that you start creating a solution by programming create programming messes. Programming languages encourage design messes, though. PHP is a programming mess waiting to happen because it attracts people who think that step one is to start coding.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    25. Re:Mixed feelings by Zero__Kelvin · · Score: 5, Funny

      "You know, people who do fancy stuff with not exactly the right tools, when the right tools were not available, ARE called "hackers".

      FTFY.

      People who use the wrong tool when the right tool is available are called PHP programmers ;-)

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    26. Re:Mixed feelings by rabtech · · Score: 1

      So, use MVC and DRY. But one day you will find a situation where they get in the way of the most elegant solution. Or, more likely, they will get in the way of hacking a new feature into some legacy POS in time to meet the deadline that Marketing already promised to the client! :D

      Wait, you mean marketing didn't tell the customer the feature was already supported in the shipping version?!?

      --
      Natural != (nontoxic || beneficial)
    27. Re:Mixed feelings by Zero__Kelvin · · Score: 1

      If you don't like to think logically, then you clearly need exactly that.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    28. Re:Mixed feelings by haknick · · Score: 2

      Great writeup. I really don't know if ppl writing here have ever programmed a real project in PHP. Check out Concrete5 and reply with a better, cleaner, faster to build modules/plugins for, more extendable open source CMS in any other language. Let's see what competition is out there. Only a month ago we finished a very similar proprietary system that is so much better than say Apache Roller (which I had prior experience), it's not even funny. Now, obviously there are certain things that PHP is just not good at because there simply wasn't any pushing in certain areas. Scala's continuations are one such thing that I really need recently and PHP is just the wrong tool for. Obviously I'm using Scala for it and the turnaround was pretty quick too (especially considering how much more complex thinking Scala requires).

    29. Re:Mixed feelings by cshark · · Score: 5, Interesting

      You know, you hear that kind of weird argument a lot from people who don't realize they've been framework programming on Microsoft platforms. They are always complaining about how primitive PHP is because it doesn't have any "built in" separation between the various heavily abstracted but highly arbitrary layers, and that they don't understand the way PHP abstracts logic, variable classes, magic methods, lambada syntax, etc. They're always pointing to perceived shortcomings in PHP, like the one data interchange layer they know about, or the fact that PHP doesn't pass complete classes as strings. The list goes on for fucking ever. The intentional ignorance of these people annoys the holy shit out of me. Or, well... it used to.

      You know, by the same criteria these "evangelist" idiots are using to judge PHP, and failing to apply their idea of "modern", they would be sorely disappointed with any number of other languages. PHP is C++ script. Plane and simple. So if you hate PHP, or you simply can't bring yourself to understand it, it's fair to assume you wouldn't like like C++ either. And for that matter, you certainly wouldn't enjoy Perl, any version of C (other than the sharp kind), Python, Ruby, Java, or any other modern language not developed by our friends in Redmond. None of them would be "modern" enough for you. Or maybe, you're just not skilled enough at your chosen craft. Nobody will ever appreciate the artist who refused to paint because he didn't like the brushes.

      PHP isn't the only language that people have written mountains of bad code on either. If you could even begin to understand the mountain of truly nightmarishly bad .net code I've had to wade through over the last decade, you would give me a fucking medal. In fact, I would wager to say that it's easier to write a large, poorly architected application in C# than it is to write one in PHP. Why? Easy. Because Visual Studio doesn't require you to actually think a whole hell of a lot about what you're coding.

      When you write something in PHP, it's a direct reflection of your ability to code. That's all it is. Code. Start to finish. You think out a problem, and then you write the code to do it. If you want to seperate it into objects, classes, or layers, you're entitled to. If you have another way to do it, that's also fine.

      PHP gives you absolute control and power over whatever it is you want to create. If you're not used to it, or ready for that kind of responsability, it can be frightening.

      So I totally understand why lesser programmers hate it.
      Personally, I like having options.

      --

      This signature has Super Cow Powers

    30. Re:Mixed feelings by LordLucless · · Score: 1

      As long as your logic is the exact same logic as intended by the author of the language.

      Yeah, pass. Support, fine; enforce, see ya.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    31. Re:Mixed feelings by leperkuhn · · Score: 1

      I agree with you that PHP's standard library is a piece of shit, but I agree with the parent's post that people create the problem. If you choose to implement the standard library in a messy fashion, it'll be a mess. I wrote PHP for a while (8 years maybe?) and the last few projects I started people were able to easily jump on board and start working immediately.

      --
      http://www.rustyrazorblade.com
    32. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Looks fine to me, and I'm a C++ developer.

      PHP is a damn fine language. There are worse, shittier languages out there.
      PHP's popularity is the reason it gets so much hate - Just don't forget it gets a lot of love too.

      And, who the hell are you to say something is shit? Grow up.

    33. Re:Mixed feelings by cshark · · Score: 1
      No, it's possessive, and you shouldn't start a sentence that way. So it would have to be:

      Let me fix that for you:

      Thus, PHP is their preferred tool set.

      --

      This signature has Super Cow Powers

    34. Re:Mixed feelings by Lehk228 · · Score: 2

      no, they would release it and call it "Windows 95"

      --
      Snowden and Manning are heroes.
    35. Re:Mixed feelings by cshark · · Score: 1

      How about Brainf*ck?

      --

      This signature has Super Cow Powers

    36. Re:Mixed feelings by alonsoac · · Score: 1

      But what do I care what other people do in PHP or whatever other language? I care about what I can do and what my coleagues can do. We are very good and efficient after 11 years using PHP. I had used Microsoft languages before that and I am very happy to have made the switch to PHP.

    37. Re:Mixed feelings by Zero__Kelvin · · Score: 1

      Talk to me when you get a new job and have to maintain other people's PHP inspired garbage.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    38. Re:Mixed feelings by Anonymous Coward · · Score: 0

      And it's not a matter of people refusing to paint because they don't like the brushes - they're saying that the brushes Zend makes are bad, and that there are other (free) brushes that aren't made badly. Most people I've talked with who want to replace PHP want to do it with Ruby, or Python, or Perl, or any of the number of free tools that work better.

      I make a living working with PHP - but there are genuine problems with the language. The global namespace is deeply polluted, performance isn't great in many areas (made up for partly by the ease and availability of caching solutions), and, frankly, some of the decisions made in its development are deeply wrongheaded (backspace as a namespace separator, for example).

      PHP has the niche it does because it does exactly two things "right." It makes it utterly seamless to mix HTML and code, and it's pig-easy to install into Apache/IIS. It does a number of other things acceptably, and its huge install base means that both the language and its libraries have a lot of functionality, but it's totally understandable to hate the language, without being some sort of "lesser programmer" or M$ drone.

    39. Re:Mixed feelings by Zero__Kelvin · · Score: 1

      Good languages don't let you commit common errors without explicitly telling the compiler (or interpreter) that you intended to do so. They support ungainly constructs, but enforce a rule that forces you to override the protection. They don't let you assign or pass a 32 bit value to a 16 bit variable all willy nilly, or cast one variable type to another accidentally. Think of C language casts for example.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    40. Re:Mixed feelings by Anonymous Coward · · Score: 0
    41. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Yes, let us write 100% from scratch of each application we make. Then, perhaps, we will not be seen as quiche eaters by those asshole assembly guys.

    42. Re:Mixed feelings by Anonymous Coward · · Score: 0

      You have a sick understanding of programming if you think enjoying programming in PHP is a prerequisite to enjoy any non-Microsoft language.

    43. Re:Mixed feelings by Beeftopia · · Score: 1

      I've got to second this comment. I came out of a rigorous C++ shop and it was startling how similar PHP was to C++ in general structure. I adhere to the basic tenets of code hygiene and I've got reliable, easily maintainable code. Yes, PHP is very loosely typed but the compiler manages it just fine.

      I use classes for all of my queries. If I want to adhere to the Model-View-Controller pattern, I write functions which are solely to display HTML, based on logic from my code (although I have to say sometimes that creates a kludge, so I don't always do it - but that's my option).

      One can write utter crap in PHP. PHP lets you. One can write total crap in C++ too. It depends on the programmer. Good code hygiene and robust planning leads to reliable, easily maintainable code in any language, just as bad code hygiene and "let's just start coding and see what happens" leads to buggy, indecipherable code in any language.

    44. Re:Mixed feelings by KingMotley · · Score: 1

      More importantly, the short trip to first base causes many "programmers" to constantly run to first base, turn around and go home, rinse and repeat without ever really figuring out what the hell they are doing. They just keep churning out the same crap code that they don't fully understand and breaks in all sorts of ways when you do this, and then that.. now it breaks because they didn't understand it. Then they'll move on to the next project (or another company) and repeat the process until...well.. forever, cause the managers/HR people will continually hire the low-salary guy that will walk in and totally screw up their systems to save $.50.

      Most of the time, I don't mind cause I get paid to clean up the mess these progtards make.

    45. Re:Mixed feelings by trojjan · · Score: 1
      I agree with the part that largely bad code is a programmer's fault rather than the language, a skilled programmer could right a great program in LOLCODE. The problem with PHP is the inconsistency in syntax. Lot of function takes arguments in a different way eg: some functions take the variable being modified first, some do the opposite. The language changes too rapidly. A lot of code written for 5.2 is deprecated in 5.3.

      So if you hate PHP, or you simply can't bring yourself to understand it, it's fair to assume you wouldn't like like C++ either. And for that matter, you certainly wouldn't enjoy Perl, any version of C (other than the sharp kind), Python, Ruby, Java, or any other modern language not developed by our friends in Redmond.

      I hate working in PHP and I love writing code in Python/C/C++. And no I don't have a lot of experience with the .net family

    46. Re:Mixed feelings by aztracker1 · · Score: 3, Interesting

      Honestly the syntax of the language doesn't bug me nearly so much as the inconsistancy_in TheApi andItsCommonLibraries. Some use pointers/handles as psuedo classes, or just plain poorly conceived and inconsistent string and array handling. I know there are frameworks on top of PHP that sterilize a lot of this, it just feels like building a house on sand. There are honestly very few web frameworks I really like, and I've worked with many of them. C# + MVC is a fav, but I've seen some wretched code in C# as well. Usually derived from "software architects" who will abstract everything out ad infinitum and sometimes to no point at all. I'm all for IoC and other abstractions and models when they serve a purpose. when you only need 5-10 method calls for a very simple web-app, it's overkill.

      C#'s greatest downfall is those developers/architects that will over-engineer what can be a simple system. PHP's greatest downfall is the sheer popularity in un-trained, or ill-thinking programmers that give the same level of bad taste VB did in the 90's for a lot of people. Bad code can indeed be written in any language, but when a language's core functionality is so poorly conceived, it's harder to write good code. For the record, not very fond of C/C++, but do like Perl okay (for text processing).

      --
      Michael J. Ryan - tracker1.info
    47. Re:Mixed feelings by aztracker1 · · Score: 1

      Thank you... I'm so sick of people assuming that just because you don't like PHP, you only do .Net (though I do in my day job). I honestly feel that some maturing in the NodeJS space will probably leave it ahead in the pack in the long run.

      --
      Michael J. Ryan - tracker1.info
    48. Re:Mixed feelings by mcrbids · · Score: 5, Insightful

      Certain, I'm going to get modded to oblivion for this, but....

      Brother I hear your music! PHP is highly underrated! It's a language flexible enough to allow you to just stick a date stamp in the middle of a random webpage, and also write a highly complex, object-oriented application framework with gorgeous abstractions.

      Performance is decent, sources are open and don't require compiling, and it's compatible with every webhost and platform out there. It scales well with it's "share nothing" approach, and is one of the most stable software packages I've ever seen. Oh, and the Documentation is excellent.

      Sure, it has it's warts: dynamic typing means that in the right contexts, 1==0, and a few others, but these are edge cases in every situation that matters. Most of the problems with OOP in PHP4 have been fixed with the now-almost-universal PHP5.

      I can do c, c++, Python, Perl, Javascript, Java, etc. but PHP is my favorite as the Chrysler K-car that doesn't win any looks contests, but always starts and gets you where you want to go, even if only at the legal speed limit.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    49. Re:Mixed feelings by aztracker1 · · Score: 1

      Sounds like what most developers I know do with JavaScript... at least with JS the language itself and its' core functionality is consistent and well documented. Though things like var a=[], b=+a, c=!b; may be confusing when you first experience it, as coercion is one of the most confusing, but strongest elements with JS, mainly stemming from loosely defined inputs in HTML. The biggest irks I have is the limitations on the build in Date (though DateJS resolves most of them) and with string formatting, though I wrote a library similar to .Net's String.Format (that works from string literals as well). Arrays and objects in JS are nicer to deal with than most other languages I've worked with, and strings are second only to Ruby/Perl imho.... PHP's core.. just ugly and inconsistent.

      --
      Michael J. Ryan - tracker1.info
    50. Re:Mixed feelings by dingen · · Score: 3, Informative

      The language changes too rapidly

      Erm... what? Have you actually looked at the changelog in the past few years? It's all bug fixes, there's absolutely nothing interesting going on there! Development in PHP has completely stagnated for years now. PHP 5.2 was released in 2006 (!!!) and still not everybody has caught on. Then 5.3 came out 3 years later, but it's even rarer to encounter that in the wild. The differences are totally marginal and the stuff they're deprecating is mainly bad stuff from PHP3 and PHP4 that you shouldn't have been using in anything for the last couple of years anyway.

      There's a lot wrong with PHP and there's a lot of bad stuff in there, but in my opinion the worst thing about PHP is the lack of progress to improve things. So no, I don't agree the language changes too rapidly, I think it's changing not nearly rapid enough.

      --
      Pretty good is actually pretty bad.
    51. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Nicely put. I agree 100% with you. All those people complaining about PHP would do well to look @ turd created in other languages as well. As you so well said, quality of code is a reflection of coder and not any programming language. Frankly, nice looking code is a lot about discipline and conventions rather than a by-product of design elegance. All these A**Ho*** think nothing of mixing "native" code inside C# because microsoft told them to. They think nothing of Ruby on Rails brain damage and happily learn all those framework monkey tricks to do simple things and never complain about bad design. The moment it comes to PHP, they all start shouting hoarse.

        I am not going to write in Occaml-pi, Haskell or Clojure just because that makes me cool. At the end of the day, I want to get my work done and PHP lets me do that and quickly. The PHP spaghetti code plastered over the Internet should be judged as Any mature language that has been used by masses would be full of cruft because this is real life. Real life is not a controlled environment and is always ugly. Maybe PHP was started in 1996 when no one thought a muck about str_replace. Maybe it became fashionable to write it StringReplace in 2000, I do not know. Are other libraries and languages (if actually used by people) not fighting for same issues?

      How come no one complains about double underscore names in linux kernel variables? Why are underscores uber cool there?

    52. Re:Mixed feelings by Xest · · Score: 2

      "Yeah cause PHP is so bad Facebook use it..."

      Yes, for historic reasons.

      But look at this very fucking article, they've basically just turned it into Java. That is of course, after they wrote something to turn it into C++ previously.

      Which proves the point, that for something large scale and scalable to this degree, then something like C++ or Java from the outset is the best tool for the job. PHP as is has clearly failed to meet Facebook's needs, hence why they've spent the whole year bastardising it into something else by replacing the translator altogether.

      If they didn't have so much existing PHP code or could simply throw their existing codebase away, you could guarantee this story would've instead been "Facebook ditches PHP".

    53. Re:Mixed feelings by trojjan · · Score: 1

      You call these mostly bug fixes?: http://www.php.net/manual/en/migration53.incompatible.php http://www.php.net/manual/en/migration53.new-features.php I'm not saying that the changes are in the wrong direction but they break a lot of existing applications especially if you use some frameworks. It's one thing to modify your application but it's completely different waiting for the upstream vendor to modify theirs. Don't tell me to modify the framework myself because that is the problem exactly, spending more time unrelated to my application brought on by changes in the language. Even if I modify the framework and submit the changes, there's no guarantee they will be in the next version of the framework. And if you want examples google 'magento php 5.3'. You get an error message any time you run a PHP script if you have the mcrypt library installed(which lot of software use including phpmyadmin).

    54. Re:Mixed feelings by icebraining · · Score: 2

      dynamic typing means that in the right contexts, 1==0

      That's not a fault of dynamic typing. The problem with PHP is that it's weakly typed. You can have dynamic but strong typing, e.g. Smalltalk, Python, Ruby, etc.

    55. Re:Mixed feelings by dingen · · Score: 1

      Looking through PHP's changelog makes it clear that adding new stuff is not exactly a priority. Sure there is a handful of new stuff, but it's taking them ages to do tiny steps forward. So it took them three years to add four new features. You think that's rapid enough to keep up with the ever changing needs of the web as an application platform? I don't.

      I understand it may be a hassle to wait for an updated framework. But that's what you get with updates. Of course I'm not going to tell you to modify a framework yourself, but it shouldn't take the maintainers of those frameworks years to update either. (If it does, you might want to consider changing frameworks.) And you don't run a cutting edge version of PHP on a production server anyway, so it's fine if you wait for the updated framework before actually updating the server itself, right?

      Things like mcrypt happen. It's annoying, but it will be resolved. It doesn't mean the whole PHP project shouldn't keep moving forward. All in all I think the number of major incompatibilities are really small and most things are announced years in advance through warnings. The documentation also does a great job of keeping people posted on changes in the way things are handled by PHP and what the best practices are regarding different subjects.

      --
      Pretty good is actually pretty bad.
    56. Re:Mixed feelings by Anonymous Coward · · Score: 1

      You're missing the point entirely.

      Yes you can write bad code in any language, and yes you can write good code in just about any language, but the fundamental problem is that PHP has many design decisions that facilitate bad practice by default for developers who don't know better, whilst other languages like Java, and C# are built to push good practice by default. Fundamentally, PHP makes it easy to write bad code, whilst some other languages make it hard to write bad code. The problem has been exagerated by the fact that PHP was late to the party with some pretty important features that should really be designed into the language from the outset to be done properly - things like object orientation, and namespaces. The problem is exagerated even further by the fact that many tutorials on the language push bad practice by default - like not using parameterised queries and just pumping SQL injection vulnerabilities into your code from your very first query.

      You've made some astonishingly obscure suggestions, and some even more astonishingly odd jumps in your logic - if you don't like PHP, you wont like C++, because PHP is C++ script - seriously, I can't even begin to tell you how many things are wrong about that statement.

      "In fact, I would wager to say that it's easier to write a large, poorly architected application in C# than it is to write one in PHP. Why? Easy. Because Visual Studio doesn't require you to actually think a whole hell of a lot about what you're coding."

      Ah, I see, so you don't actually have any real experience of C# development at all do you but feel qualified to slag it off anyway? I mean, you wouldn't make such a blindingly false statement otherwise. Visual Studio plenty requires you to think about what you're coding, you can't take away the fundamental fact that software development requires you to solve logical problems, Visual Studio doesn't magically automate that away. The reason you'll write better code in C# is because you're basically forced to use things like namespaces, you're given tools like a decent debugger, you know, that thing the vast majority of PHP developers don't even use. Perhaps most importantly, you're forced to avoid countless errors and bugs at compile time that PHP will simply allow to go unnoticed - again, something that could be avoided with an easy to use and pretty solid unit testing suite that the likes of Visual Studio provides, but I wouldn't expect you to know about that sort of thing - again, most PHP programmers don't bother with things like unit testing. Perhaps it's because they're so awesome, and just don't need it.

      "So I totally understand why lesser programmers hate it.
      Personally, I like having options."

      Really? You like having the option of writing really, really bad code? you think being able to do so, and being allowed to make mistakes, and hence not be protected against the fact that even the most perfect human being that has ever existed still made mistakes makes you a better programmer?

      I think perhaps you have a grossly overinflated view of your own level of competence. Much of what you say isn't compatible with your claim of putting yourself above "lesser programmers". Sadly, it's the arrogance of people like you with your "I'm an uber programmer that never makes any mistakes" attitude that is the reason for the overwhelmingly large amount of trivially avoidable XSS, SQL injection, and buffer overflow attacks that still plague the web. Really, your argument, summed up, is this:

      "PHP isn't any worse than any other language for bad practices, because I'm an uber developer who never makes any mistakes ever, and just because I can choose to make bad mistakes in PHP, doesn't mean it's worse than a language that doesn't give me the choice, or leave open the door for me to accidently make as many bad mistakes."

      You really don't see how stupid that all sounds?

      PHP is great for knocking things together quickly, it's fantastif for prototyping, and it's even good for some pretty large sites. But

    57. Re:Mixed feelings by thetoadwarrior · · Score: 1

      But some programming languages encourage people to make a mess.

    58. Re:Mixed feelings by thetoadwarrior · · Score: 1

      I present to you http://www.reddit.com/r/lolphp/

      PHP is full of bad practices and if you do want to rely on the documentation and you're new to programming you're going to see a load of poor code in the user contributed comments. There is no level of moderation to ensure people are putting acceptable help on the site so not surprisingly it's mostly crap.

    59. Re:Mixed feelings by thetoadwarrior · · Score: 1

      Or he's really old to programming and doesn't keep up. PHP used to be a Perl framwork.

    60. Re:Mixed feelings by Anonymous Coward · · Score: 0

      Facebook has not yet deployed this, so the FB website *at this moment* is running straight PHP.

    61. Re:Mixed feelings by pandronic · · Score: 1

      I don't think that you should write every library you use from scratch, but I think that, if you consider yourself a programmer, you should be able to it if the need arises.

    62. Re:Mixed feelings by Xest · · Score: 1

      No they haven't:

      http://developers.facebook.com/blog/post/358/

      They've been converting PHP to C++ and compiling it with GCC.

      They haven't been using straight PHP for at least 3 years now for precisely the reason that it hasn't scaled for them as they've needed it to.

    63. Re:Mixed feelings by trawg · · Score: 1

      Well, basing your coding on unmoderated, non-peer-reviewed, user-contributed comments is something that will bite you in the ass regardless of which language you use. I bet there is more terrible C code out there to copy and paste than examples in the PHP documentation simply because the language has been around for longer!

    64. Re:Mixed feelings by Rockoon · · Score: 1

      All programming languages encourage people to make a mess.

      FTFY

      --
      "His name was James Damore."
    65. Re:Mixed feelings by Sez+Zero · · Score: 1

      "You know, people who do fancy stuff with not exactly the right tools, when the right tools were not available, ARE called "hackers".

      FTFY.

      People who use the wrong tool when the right tool is available are called PHP programmers ;-)

      "People who use the wrong tool when the right tool is available" can be abbreviated "hack".

      There's a fine etymological line between someone who is a hack and hacker, but a huge real-world difference.

    66. Re:Mixed feelings by FictionPimp · · Score: 1

      It doesn't just make itself easy to install on servers, but in general most php projects are designed to be easy to install. Read though the instructions on a Ruby application that will typically require a half a dozen pages of setup instructions and compare it to a php application that amounts to "drop in www folder, run install.php"

    67. Re:Mixed feelings by Anonymous Coward · · Score: 0

      PHP is C++ script. Plane and simple. So if you hate PHP,

      And no wonder - a scripting language based on C++. Ugly.

      And for that matter, you certainly wouldn't enjoy Perl, any version of C (other than the sharp kind), Python, Ruby, Java, or any other modern language

      And for that matter, I wouldn't expect or want a scripting language when I was dong systems programming. I love Ruby and Python looks interesting, but PHP is an ugly mess in comparison. I don't want my scripting languages to look like system languages, thank you very much. And I certainly never confuse Ruby with C/C++.

    68. Re:Mixed feelings by DrSkwid · · Score: 1

      iterating over arrays and printing doesn't need new language constructs every 5 minutes.

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    69. Re:Mixed feelings by DrSkwid · · Score: 1

      I write my projects in PHP because hiring my replacement will be cheaper.

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    70. Re:Mixed feelings by John+Courtland · · Score: 1

      Did you even click the link? PHP is objectively a bad language and a bad platform with a toxic ecosystem.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    71. Re:Mixed feelings by Anonymous Coward · · Score: 0

      "loathe" is the word you're looking for. You are loath to use PHP, and you loathe those who do.

      (the more you know....)

    72. Re:Mixed feelings by Metabolife · · Score: 1

      I'm ZERO COOL, and I resent that statement. There is always a GUI driven "right" tool for the job.

    73. Re:Mixed feelings by Eponymous+Hero · · Score: 1

      been there done that. also been there done that with other people's asp, coldfusion, javascript, actionscript, html, css, misused MVC pattern, poor sql schema inspired garbage. you're throwing stones from a glass house. hell is other people's code. period.

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
    74. Re:Mixed feelings by rev0lt · · Score: 1

      Saying PHP is full of bad practices is a bit like saying assembly is full of bad practices - with freedom comes responsability. The documentation by itself isn't stellar, but there are tons of available books and (good)articles that can help you on the first steps. Most of the "poor code" you mention are actually poor algorithmic implementations, but then again the documentation isn't there to teach you how to program - is there to show you the syntax and the different options available.

    75. Re:Mixed feelings by rev0lt · · Score: 1

      So, it's a bit like every other language, then?

    76. Re:Mixed feelings by rev0lt · · Score: 1

      Is it different than mantaining other people's (C++/C+/.NET/Delphi/Cobol/Java/Ruby/Whatever) inspired garbage?

    77. Re:Mixed feelings by rev0lt · · Score: 1

      How did you went from "php is probably not the better choice" for "C++ or Java probably will do it"? Because they made a C++ translator, or because you think what they implemented is a Java concept?
      Replying to your other comment, there is also a difference between "this doesn't work" and "lets save a ton of money on servers and such by running binary instances of our applications and squeeze some more requests/s". Facebook did the PHP/C++ translator because of economic reasons, not because PHP couldn't scale.

      But yes, in retrospective, I also share the opinion that using PHP (and MySQL) for something like facebook was a terrible design option. That doesn't mean it didn't worked.

    78. Re:Mixed feelings by TheLink · · Score: 1

      Heh I've written a DHCP server in perl, and a windows "hotkey" utility in python (amongst other stuff :) ).

      That said, I dislike php. It makes doing really wrong things easier and right things hard. It's a bad sign when the PHP developers/creators actually released stuff like "magic quotes" and addslashes. Then there's the mysql_real_escape_string stuff. When you see stuff like this you should know how crappy PHP is.

      --
    79. Re:Mixed feelings by TheLink · · Score: 1

      Programming languages don't create programming messes. People do.

      People can create programming languages that make programming messes easier.
      http://en.wikipedia.org/wiki/INTERCAL
      http://en.wikipedia.org/wiki/Malbolge
      http://en.wikipedia.org/wiki/Befunge
      http://en.wikipedia.org/wiki/Brainfuck

      PHP may not be as fucked up, but at least the above languages were actually jokes. When a language has stuff like register_globals, "magic quotes", addslashes and mysql_real_escape_string, you should not use it for anything serious.

      Yes they've deprecated some of the crap but they can't remove all the crap because lots of existing PHP crap apps depends on that crap. They were actually PHP-isms that made PHP PHP.

      If you're starting something new, don't use PHP - if you want a PHP minus all the crap you might as well use some other language.

      --
    80. Re:Mixed feelings by John+Courtland · · Score: 1

      I agree with your sentiment; the only language that doesn't suck is one you haven't written anything meaningful in -- and I've written a LOT of php.
      I do think it's worse than most, with more defects/regressions per release than any other major platform and a really unsound underlying architecture built by a guy who literally hates computer science.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    81. Re:Mixed feelings by krinderlin · · Score: 1

      God what I would give for mod points. Drupal, Wordpress, and PHP-Nuke are to blame. The skinning/module/plug-in ecosystems alone will keep inertia for years. And then, because of them, all the people on in-house projects think that they can emulate these PHP based successes. I don't have a problem with Drupal or Wordpress and I've not a clue about PHP-Nuke. I can only imagine the struggle it is to keep up with all the "PHP version N+1 breaks X".

      As an aside, DotNetNuke is really not that bad, and I've seen some pretty awesome things on the designer side. I think my favorite was my friend dropped $99 USD for a WYSIWYG skinner that worked right in the browser. Very sexy.

    82. Re:Mixed feelings by John+Courtland · · Score: 1

      Describe "freedom" in the context of your statement.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    83. Re:Mixed feelings by MikeBabcock · · Score: 1

      No offense, but how many comp sci courses have you taken?

      I read your rant and don't see any valid defense of the mess that PHP is.

      --
      - Michael T. Babcock (Yes, I blog)
    84. Re:Mixed feelings by MikeBabcock · · Score: 1

      Used Python lately?

      --
      - Michael T. Babcock (Yes, I blog)
    85. Re:Mixed feelings by trawg · · Score: 1

      I did click the link - I saw a list of a handful of things that have never bothered me in 10+ years of writing and managing PHP developments.

      I understand that it is easy to get frustrated by things like that but I just shrug and move on with my life and try not to get caught again in future.

    86. Re:Mixed feelings by Zero__Kelvin · · Score: 1

      " you're throwing stones from a glass house"

      Ironically, that expression doesn't evaluate the way you think it does ;-)

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    87. Re:Mixed feelings by Zero__Kelvin · · Score: 1

      "Is it different than mantaining other people's (C++/C+/.NET/Delphi/Cobol/Java/Ruby/Whatever) inspired garbage?"

      Why do I have the feeling that, if I ever have to maintain yours, I'll find out? ;-)

      (... for example, C+ isn't a language; you presumably meant C# )

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    88. Re:Mixed feelings by Xest · · Score: 1

      "How did you went from "php is probably not the better choice" for "C++ or Java probably will do it"? Because they made a C++ translator, or because you think what they implemented is a Java concept?"

      Well it's pretty simple really, both C++ and Java (and to a lesser extent, .NET) have a proven track record of scaling succesfully to the sort of degree Facebook requires - Google's search back end, eBay etc. but also that what they have implemented, whilst not explicitly a Java concept, is a case of going down the route Java has to succesfully scale - because they can't afford to ditch their existing code base for Java, they're doing the next best thing, and making PHP run in a Java-esque manner.

      "Facebook did the PHP/C++ translator because of economic reasons, not because PHP couldn't scale."

      Well yeah, if you have unlimited funds I'm sure you can get anything to work. You could probably get even the most inefficient of interpreted languages to scale if you're willing to buy a custom supercomputer, or cluster of, and pay for your own power plant to run and cool it all. In this respect you can say anything scales.

      But if even Facebook can't afford to make PHP scale, then that's equivalent to saying it just doesn't scale well enough, as money is a major limiting factor in getting something to scale. If the standard PHP engine is too low performance to scale affordably then that in itself is enough reason to say it doesn't scale. Unless you're one of those people who spends their life missing the point and would've preferred I spelt it out explicitly and said "PHP doesn't scale in an affordable manner" then I'm not sure what your point is.

    89. Re:Mixed feelings by rev0lt · · Score: 1

      Maybe you know more than I do - but I never read the claim that those companies you mentioned are running stock Java, or plain old C++ without some heavy tweaks and magic juice to suit their needs. Not that Facebook doesn't use those technologies - in fact, Facebook is, for example, one of the major users of Hadoop. So, if a major company tweaks Java or C++ or whatever to suit their needs is ok because it's a "language you approve", but if other company tweaks PHP, it's bad decause PHP is bad?
      ...And yes, PHP can be run on JVM. And can be compiled to .NET assemblies. Maybe it won't run as fast as Java (I don't know, never used it that way). And yes, I do agree with you, choosing PHP probably was a terrible design decision. As it would have been Ruby, Perl, Python and many other languages. But what you lose in execution time you gain in development time. How much it took (in time and money) to go from a fast prototype to a production installation?

      My point is, not everyone needs to write facebook, development time is often a lot more expensive than hardware, and just because they decided to tweak their platform doesn't mean necessarily that the language is "bad". And those who _do_ write facebook, already use many of the alternative technologies you mentioned.

    90. Re:Mixed feelings by rev0lt · · Score: 1

      Actually I meant C. C# is a .NET language. But don't worry, I'm too lazy to re-invent the wheel, so don't expect a new language out of me :)

    91. Re:Mixed feelings by rev0lt · · Score: 1

      Having professionally programmed in Cobol, indented languages are a horrible horrible concept that impose artificial constraints in the sake of legibility for those who can't actually decipher the code, and should be reading comments instead. I've tried Python, and while it feels more versatile than PHP out of the web environment, there's not that much of a difference to justify the change.
      For me, the Python programmer is a bit like the PHP programmer - if you can only use Python (or PHP), you're not a programmer.

    92. Re:Mixed feelings by rev0lt · · Score: 1

      The freedom of choice - to write good, manageable code, or to write some soup-tag mess. You can write structured code in assembly, or just slap in some instructions to test some proof of concept.

    93. Re:Mixed feelings by John+Courtland · · Score: 1

      That's what I thought but I wasn't sure what you meant. Just fyi, you can say that about any Turing complete language so I guess I don't understand what your point is.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    94. Re:Mixed feelings by Eponymous+Hero · · Score: 1

      are you saying you don't get it?

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
    95. Re:Mixed feelings by Dhalka226 · · Score: 1

      And how much more effort and money would it have taken to get the project off the ground going that route? Would Facebook even exist if it had to be done in Java or PHP? Would it have entered the market at an appropriate time? There are a lot of things that derail could derail the process, especially a process begun essentially for lulz. Yeah, if somebody had promised Zuckerberg that Facebook would soon be valued in the billions he might have made other choices, but there are no such guarantees in life.

      As it stands, he used a language he was clearly familiar with and for which there is ample and comparably cheap developers available and he got his product out and dominates the market. I doubt he is sitting around going "fuck, I can't believe I didn't write this is Java!" It worked out pretty damn well for him, and the rest of us get a tool to make our PHP projects better.

      If you're writing a program you know will need to scale like this, yeah, maybe Java or C++ is the best choice. Beyond that I consider fretting over language instead of getting something done to be a premature optimisation.

    96. Re:Mixed feelings by Dhalka226 · · Score: 1

      had to be done in Java or C++*, that is.

    97. Re:Mixed feelings by Xest · · Score: 1

      I agree to some extent, PHP is great for rapid prototyping or rapidly getting something to market, but honestly it's not as if Java is so slow to develop with that it would've added any delay in getting the project to market that would've stunted it's success as the success was largely on the business side of things anyway - the idea of Facebook wasn't new, MySpace had been doing the same sort of thing before, and friends reunited before that. He'd have got the business side right regardless of technology used. C++ is slower to develop with and getting that in a usable state for an initial release may well have been a bit more problematic, and led to potentially more and more serious security flaws that could've been enough to kill the project in it's tracks in it's early days, but even there if you use some of the great libraries available it shouldn't be too big an issue.

      Reading the comments from Facebook devs themselves about their new tools it sounds very much like they wish they were working with something like C++ or Java, but recognise now it's too late or too big an investment to now switch and so for them, this is the next best thing.

    98. Re:Mixed feelings by Xest · · Score: 1

      You seem to be going down some pretty odd paths to try and justify your argument, it's a little odd.

      I'm not really sure what tweaks you think the likes of eBay would do, it's not like they need to completely rewrite the JVM and replace it, at most it'll be down to configuration options, but configuring the JVM is hardly the same as completely replacing the PHP interpreter with a VM written from scratch. Yes on these sorts of systems there's a lot of custom configuration you'll have to do, but it's not really the same as having to modify the entire underlying platform.

      Regarding development time it's often a bit of a fallacy on a large project, PHP is great for getting something up and running quickly, so great for prototyping, or small projects, but if you want anything bigger then large PHP codebases become so horrible to maintain that at that end of the scale you'll likely find development more costly - particularly when you start having to deal with greater performance issues meaning you'll need to resort to optimisations which grossly reduce maintainability to get performance to a level where other languages and platforms are without needing such hacks. Of course, you can do those optimisation hacks in those languages too, but then you get even greater performance again. The problem is an even bigger issue if you're talking about a codebase from before PHP properly supported OOP, Namespaces and the likes, and even now unit testing in PHP isn't that great so things like regression testing is infinitely more difficult than it is with say, C# .NET MVC and Visual Studio's MSTest suite, or Java and JUNit and related tools.

      If there's any chance that your site is going to grow massively then PHP is a bad choice, if you're just talking about your own personal home page, or an internal site, or a site with a known amount of users and so forth then yes it's an excellent choice, but we're seeing the same with Facebook as we did with Twitter - they chose tools best suited for small scale development and have suffered scalability issues. In contrast, companies like Google, eBay, and so forth used the right tools from the outset and have not had these kinds of problems where the whole underlying codebase and execution environment was in question.

    99. Re:Mixed feelings by Anonymous Coward · · Score: 0

      That is without a doubt the stupidest thing ever posted on slashdot. And given what a fountain of stupidity this place is, that is an impressive feat.

      Your bizarre fantasy of PHP being the holy grail of open source and everyone who dislikes it is an MS drone is astounding. There is a huge world of open source languages that don't suck shit. You seriously think all the python, ruby, perl, C, pike, haskell, ocaml, sml, clean, lisp, scheme, java, clojure, scala, etc, etc, etc people are all "lesser programmers" and "don't realize they've been framework programming on Microsoft platforms"? How is it even possible to be that stupid and still be able to read and write? I would imagine you need someone to dress you in the morning given the intellect you've displayed.

      PHP is a shitty language. It is missing tons of useful functionality, and has broken and inconsistent implementations of most of the functionality it does have. You only think PHP offers you all the abstractions you need because you've never tried a better language, so you don't know what you are missing. The entire history of PHP has been nothing but: "Oh look, we added X! PHP is totally like a real language now guys!". Except that there's 3 pages of "it's a feature not a bug"s and gotchas and limitations and shortcomings that make X not actually useful.

      Do yourself, and everyone who ever has to see your code a favor: bookmark your post. Then spend a year learning another language. Actually learning it, for real. Then come back to your post and facepalm at what an arrogant, ignorant dumbass you were.

    100. Re:Mixed feelings by rev0lt · · Score: 1

      I actually don't know enough about those big company's internals to know what kind of optimization they apply. What I know is what everybody knows. I know that google rewrote a JVM for their smart device operating system, in part due to performance reasons (but yes, mainly due to copyright reasons), and the result is similar to a somewhat polished turd. If they have a team capable of rewriting the JVM for a specific market segment, I'd guess they've done some pretty impressive work on the one they're using for "everything".
      I honestly don't know what you consider to be large codebases. I'm not trolling, people have different experiences. I've worked with Cobol codebases bigger than some releases of the linux kernel (>300Mb) without any project management or source revision whatsoever. For me, it's a large codebase on a crappy (ohhh so crappy) language. I've also worked with .NET applications with 800 forms. For me is a medium-large codebase. Mabye for what you've seen isn't.
      The problem maintaining large PHP codebases isn't PHP itself, it's assuring that crappy code isn't commited, and that all the programmers work at the same level. And since you mention unit testing, it seems this particular problem is the crux of the issue. I don't do unit testing - (I don't "believe" in unit testing - the reasons behind that would be enough for another thread, but let's say I start coding in the nineties). I do some regression testing, but I can see where a big corporation would need to depend on unit testing as an assurance of code quality/conformance on large teams, specially when hiring based on buzzwords and not necessarily competence.
      As I said before, yeah, for something facebook-sized, PHP is probably a poor decision(to say it nicely). But it doesn't mean that Java or C++ is the saviour. As an example, they could probably re-code the whole thing in Erlang and have a huge increase in performance, while reducing significantly their codebase. Or maybe their major problem isn't even PHP, they just had a team working on some optimizations. Having structural issues and being verbose about it is not a very good idea if a company is going public soon, so I doubt PHP is one of their major worries (specially given they also seem to use MySQL). But then again, I don't work there - do you?

  4. much more traditional solution by Trepidity · · Score: 2

    Interesting that they've settled on this approach, which in some ways is much more traditional: developing a high-performance JIT for a dynamic language instead of trying to statically compile a subset. Basically the approach taken by StrongTalk, V8, PyPy, Rubinius, etc.

    1. Re:much more traditional solution by Anonymous Coward · · Score: 0

      The initial version of Hiphop was a static compiler but that just didn't work for them for some reason.

      But what they created is just another ZendEngine.
      Note that the do not give a PHP+APC benchmark because it is probably just as fast as their HipHopJIT creation.
      What a waste of time and resources.

      *sigh*
      Just getting tired of all these second rate programmers at these big companies spamming major news sites with their so-called innovative solutions that merely replace existing solutions without showing any major improvement or just solving very specific solutions for their own organisations.
      *gets another cup of coffee*

    2. Re:much more traditional solution by loufoque · · Score: 2

      Statically compiling a subset would yield much better results, but would be significantly harder to do.

      They took the easy way out; this is not a compiler any more than the reference implementation is. It's just a replacement for the reference implementation that sucks a bit less in terms of performance.

    3. Re:much more traditional solution by gsnedders · · Score: 1

      PHP is far less dynamic than JavaScript, Python, Ruby, etc., though: function and class assignments are constant (though first-class functions exist in PHP 5.3, they're rarely used and probably aren't worth spending *too* much time optimizing for). The main source of dynamism is the dynamic weak typing, everything else is far closer to most compiled languages.

    4. Re:much more traditional solution by olau · · Score: 1

      Statically compiling a subset would yield much better results, but would be significantly harder to do.

      Why do you say that? Just curious. It seems to me that JIT compilers have the promise of being able to optimize things based on what's actually going on rather than what might theoretically be going on.

    5. Re:much more traditional solution by Rob+Aley · · Score: 1

      They have a static compiler, called HipHop (NOT the HipHop VM that this article refers to) which is used in production as we speak, and it came before the JIT version.

    6. Re:much more traditional solution by Rob+Aley · · Score: 1

      The static version did indeed work for them, it's currently used in production across Facebook. The JIT version was developed for use during development, the existing optimised version of the standard PHP engine they were using wasn't fast enough and had incompatibilities with HipHop. So they developed the JIT version for development to speed iterative development (without the overhead of static compilation), and then they deploy to production. I hate Facebook, I don't have an account, but I do like some of their engineering practises and processes.

    7. Re:much more traditional solution by Anonymous Coward · · Score: 0

      instead of trying to statically compile a subset...PyPy

      Actually PyPy does both. PyPy has a statically compiled subset which is then used to develop PyPy itself. The result of a statically compiled subset is then used to create a dynamic Python JIT. Just the same, the static subset is still available for those who do not wish to maintain Python compatibility.

    8. Re:much more traditional solution by cgaertner · · Score: 1

      It seems to me that JIT compilers have the promise of being able to optimize things based on what's actually going on rather than what might theoretically be going on.

      Keep in mind that dynamic recompilation does not come for free - the actual compilation aside (which must be reasonably fast, ie a just-in-time compiler probably won't optimize as heavily as an ahead-of-time compiler), you also need to add introspection hooks to determine hot code paths and insert guards to check if preconditions still hold.

      In most cases, runtime optimization can't compete with profile-guided link-time optimization, which gets you many of the benefits of the former without any runtime overhead whatsoever.

  5. So True. by jmichaelg · · Score: 1
    From the article....

    The first 90% of the hhvm project is done; now we're on to the second 90% as we make it really shine.

    1. Re:So True. by Local+ID10T · · Score: 1

      From the article....

      The first 90% of the hhvm project is done; now we're on to the second 90% as we make it really shine.

      Good at math they are not...

      --
      "You want to know how to help your kids? Leave them the fuck alone." -George Carlin
    2. Re:So True. by Jack9 · · Score: 4, Insightful
      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    3. Re:So True. by Rennt · · Score: 4, Funny

      It's a form of hacker koan. In your eagerness to be a smartass you failed to reach enlightenment.

    4. Re:So True. by fsckmnky · · Score: 1

      From the article.... The first 90% of the hhvm project is done; now we're on to the second 90% as we make it really shine.

      And when they are finally done optimizing it, squeezing every last bit of performance out of it, adding the ability to compile to a native binary, they will have achieved the remarkable accomplishment of having re-invented the C compiler.

      Way to go Facebook. Keep up the good work. ;)

    5. Re:So True. by Anonymous Coward · · Score: 0

      That would be a great video game end screen:

      "You have failed to reach enlightenment."

      And the joke would be that there is no way to reach enlightenment inside of the game.

    6. Re:So True. by PCM2 · · Score: 1

      And when they are finally done optimizing it, squeezing every last bit of performance out of it, adding the ability to compile to a native binary, they will have achieved the remarkable accomplishment of having re-invented the C compiler.

      They did that already. They're moving away from static compilation in favor of running it in a VM with a JIT.

      --
      Breakfast served all day!
    7. Re:So True. by fsckmnky · · Score: 1

      They're moving away from static compilation in favor of running it in a VM with a JIT.

      Which is a complete step backwards if their goal is performance.

    8. Re:So True. by garyebickford · · Score: 2

      I generally extend to the third ninety - the last 1% of the code take the third ninety percent of the time. This is a pretty good model for the difference between a good, working program and one with a shiny user interface and most of the beta-bugs worked out.

      Or, as someone I worked with who had been at BBN working on the original ARPAnet said, "Take whatever schedule the engineers give you, double it and convert to the next higher units." (two weeks => four months, etc.)

      --
      It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    9. Re:So True. by PCM2 · · Score: 1

      Which is a complete step backwards if their goal is performance.

      Not really. JIT technology is pretty advanced these days. (It's good enough for Java, anyway.) More importantly, though, my understanding is that static compilation forced them to heavily restrict their coding style. PHP being a dynamic language, there were a lot of features they had to leave on the table to make it work that way.

      --
      Breakfast served all day!
    10. Re:So True. by fsckmnky · · Score: 1, Interesting

      (It's good enough for Java, anyway.)

      Which is at least 50% slower on its best day, than C/C++ on it's worst day.

      As for JIT, it's a non-issue. Anyone could make .c or .cpp files executable, by passing them through the linux kernels MISC binary capability. [see "Kernel support for MISC binaries" under "Executable file formats / Emulations"].

      It's the VM part that kills performance. The Java VM, and presumably, the PHP VM, do not execute native machine instructions, but instead, use an intermediary format, as opposed to, native cpu instructions. This is what kills performance.

      If one wanted both JIT and a "virtual environment" ( for security reasons ) ... one could use the misc binary feature of linux, combined with "linux resource containers" to achieve a virtualized environment ( machine ), isolated for security purposes, which executes native code, with almost 0 overhead.

      Maybe they'll figure it out, but I doubt it, because they are already heavily invested in PHP. Bleh.

      Combine that with the remarkable similarity between PHP syntax and C ( but without the speed ) and maybe you understand why I say ... congrats, they've re-invented C. They've just done it without the last 40-50 years of iterative performance enhancements that have been applied to C/C++ compilers already.

    11. Re:So True. by PCM2 · · Score: 4, Interesting

      Which is at least 50% slower on its best day, than C/C++ on it's worst day.

      Got any numbers to back that up, or are you just pulling it out of thin air?

      It's the VM part that kills performance. The Java VM, and presumably, the PHP VM, do not execute native machine instructions, but instead, use an intermediary format, as opposed to, native cpu instructions.

      You don't seem to understand how a JIT works. Many portions of Java programs are indeed executed as native machine instructions.

      Combine that with the remarkable similarity between PHP syntax and C ( but without the speed )

      I wouldn't call the similarity "remarkable." "Superficial" might be a word I'd use, in the sense that Java syntax is also similar to C.

      --
      Breakfast served all day!
    12. Re:So True. by fsckmnky · · Score: 1

      Now that I go and read the article, I see they have created a "PHP to C++" translator of sorts, not so much a JIT VM combination. It won't be nearly as bad performance wise, but, why even f' with PHP at that point.

    13. Re:So True. by loufoque · · Score: 1

      Got any numbers to back that up, or are you just pulling it out of thin air?

      Java doesn't allow efficient memory layout of objects, and therefore cannot be as efficient as C++.
      The only way to write code with good performance in Java is to call primitives written in C or C++ that do significantly more work than what you're doing in Java manipulating those primitives.

    14. Re:So True. by daid303 · · Score: 2

      He asked for numbers.

      And I got numbers for you, from PyPy (Python JIT), showing that PyPy is faster then C in some cases.
      http://morepypy.blogspot.com/2011/08/pypy-is-faster-than-c-again-string.html

    15. Re:So True. by loufoque · · Score: 1

      There is no need for numbers. Performance depends on today's architectures mostly depends on cache friendliness, and Java does not allow object layouts that are cache friendly.

      And I got numbers for you, from PyPy (Python JIT), showing that PyPy is faster then C in some cases.
      http://morepypy.blogspot.com/2011/08/pypy-is-faster-than-c-again-string.html

      This is ridiculous and irrelevant to PyPy's performance. This only measures the performance of a built-in function. And PyPy is only faster because it inlines sprintf. Which you can also do in C; it's simply not done by default because it's not a good idea.

    16. Re:So True. by ZigMonty · · Score: 1

      This is becoming a divergent version of Zeno's paradox.

    17. Re:So True. by Rob+Aley · · Score: 1

      They're moving away from static compilation in favor of running it in a VM with a JIT.

      Which is a complete step backwards if their goal is performance.

      They've actually developed this for use in their iterative development process, not for production. It is significantly quicker than the standard PHP engine but doesn't have the overhead of static compilation. Shaves small amounts of time off, but it all adds up. The original HipHop static compiler which they use in production is significantly faster.

    18. Re:So True. by Anonymous Coward · · Score: 0

      I love Python but corner cases do not a language make. You are disingenuous at best. Like all Java fanatics before you, you do a great disservice to prop up your language of choice on corner cases which are not the least representative of the majority of real world applications.

      Unlike what happened with Java, the PyPy developers are very fast to point out exactly what I'm saying above. This is in stark contrast to what happened with Java, whereby, in 0.05% of production code, some small subset was faster than poorly written, unoptimized C/C++, who then falsely bragged Java is faster than C. Many brain dead fell in line to repeat those lies.

      The sad truth is, in the majority of benchmarks where Java is faster than C/C++, its because the C/C++ code is poorly written and/or they absolutely are not (and purposefully done so) an apples to apples comparison. Furthermore, most Java benchmarks go out of their way to avoid garbage collection which would be unavoidable in most real-world applications. The simple fact is, most Java benchmarks are first and foremost created for the sole purpose to deceive and misrepresent Java in a positive light.

      Long story short, a hint of truth built on a stack of lies does not make it true.

    19. Re:So True. by vipvop · · Score: 1

      Good garbage collectors manage locality of reference, copying and compacting objects together to ensure cache hits when possible. This is nothing new, and you can find papers from the early 1990s talking about this. This is one of the reasons given for the many times when Java does run faster than something like C++.

    20. Re:So True. by PCM2 · · Score: 1

      There is no need for numbers. Performance depends on today's architectures mostly depends on cache friendliness, and Java does not allow object layouts that are cache friendly.

      If someone tells me "no VM can execute code on its absolute best day with performance that's half as good as C++ on C++'s worst day," I think there's need for numbers. Because that sounds like absolute B.S. to me. At best it's totally subjective, in the sense that the true performance and scalability of a Web app like Facebook might not be reflected by raw C++ benchmarks. At worst, it sounds like someone has missed out on the last couple decades of VM technology.

      --
      Breakfast served all day!
    21. Re:So True. by PCM2 · · Score: 1

      So based on this chart, the assertion that the best Java program will be half as fast as the worst C++ program is false.

      --
      Breakfast served all day!
    22. Re:So True. by Anonymous Coward · · Score: 0

      Here you go:

        PHP
          http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=php&lang2=gpp

      Java
          http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=java&lang2=gpp

      Ruby
          http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=yarv&lang2=gpp

      Jython
          http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=python3&lang2=gpp

      JITs have a long way to go over compiled code, 50% is more than a reasonable estimate.

    23. Re:So True. by krinderlin · · Score: 1

      Robot Unicorn Attack is similar with "reaching your dreams."

    24. Re:So True. by fsckmnky · · Score: 1

      .If someone tells me "no VM can execute code on its absolute best day with performance that's half as good as C++ on C++'s worst day

      I never said that. You just think I said that, because you are as emotionally attached to Java as you are challenged when tasked with reading comprehension.

      What I said, verbatim, was "Which [Java] is at least 50% slower on its best day, than C/C++ on it's worst day." in response to your claim that "JIT technology is pretty advanced these days. (It's good enough for Java, anyway.)".

      Furthermore, in an additional post I stated very clearly "As for JIT, it's a non-issue. ... It's the VM part that kills performance." to which you replied "You don't seem to understand how a JIT works." further failing to comprehend or address the actual subject matter.

      Be honest with yourself first, and then you can be honest with others.

    25. Re:So True. by fsckmnky · · Score: 1

      So based on this chart, the assertion that the best Java program will be half as fast as the worst C++ program is false.

      From the website you linked to, found at http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php

      C GNU gcc 1.00 1.00 1.00 [1.02] 1.26 1.65 3.24
      C++ GNU g++ 1.00 1.00 1.01 [1.07] 1.29 1.72 4.31
      Java 7 averaged 1.05 1.05 1.24 [1.47] 1.94 2.04 2.04
      Java 7 -server 1.11 1.11 1.36 [1.65] 2.04 3.07 5.94

      The [] bracketed numbers are the median of all the tests.
      The C and C++ average is 1.02 + 1.07 = 2.09 / 2 = 1.045
      The Java 7 averaged and Java 7 -server average is 1.47 + 1.65 = 3.12 / 2 = 1.56

      The average performance ratio of Java/Server vs C/C++ is 1.56 / 1.045 = 1.492823 ... or in other words ... 49.2823 % slower.

      My original statement was

      Which is at least 50% slower on its best day, than C/C++ on it's worst day.

      Which is not what you remembered incorrectly and then misrepresented it to be as

      the best Java program will be half as fast as the worst C++ program is false.

      So in summary, my comment was within a 2% margin of error accurate, based on statistics you presented as valid, and you suck at reading comprehension and math, and you post falsehoods as a result. The evidence bears this out, no need to kill the messenger.

    26. Re:So True. by fsckmnky · · Score: 1

      errata ... from the website by rgbrenner linked to. We all make mistakes.

    27. Re:So True. by PCM2 · · Score: 1

      I honestly don't understand how you're interpreting the English language.

      You said: Java is at least 50% slower on its best day than C/C++ on its worst day.
      I said: [Java cannot] execute code on its absolute best day with performance that's half as good as C++ on C++'s worst day.

      Pray, what is the difference between these two statements, other than length? I have no emotional attachment to Java or any programming language.

      --
      Breakfast served all day!
    28. Re:So True. by PCM2 · · Score: 1

      The average performance ratio of Java/Server vs C/C++ is 1.56 / 1.045 = 1.492823 ... or in other words ... 49.2823 % slower.

      I'm not sure I understand your math. You seem to be demonstrating that C is 49 percent faster, not that Java is 49 percent slower.

      A score of 1 is 50 percent slower than a score of 2. Obvious, no?
      A score of 1 is only 33 percent slower than a score of 1.5. Still slower, but not as much as you claim.

      And as for your comments about best and worst days, that's just hyperbole, and as I said elsewhere, benchmarks do nothing to represent either of those conditions. They only demonstrate benchmarks.

      --
      Breakfast served all day!
    29. Re:So True. by fsckmnky · · Score: 1

      {facepalm}

    30. Re:So True. by loufoque · · Score: 1

      That's not what I said.
      Any language can allow you to make code slow.
      But only a few languages allow you to make code as fast as it can be. Java isn't one of them.

      Python or Java might be faster than C++ on some examples because of the facilities that the code is using. The code being compared is not really equivalent, all that it proves is that the standard libraries with the default settings perform better for that kind of use case, it doesn't say anything about the language at all. You could always rewrite the C++ code to do exactly the same thing as the Java and Python code. You couldn't do it the other way around.

      In particular Java does not allow you to define how objects are placed in memory; worse, all objects are actually pointers.
      It forces fragmented memory and unnecessary dereferencing. There are compacting garbage collectors that are supposed to reduce this problem, but it just cannot be as good as a good memory layout design. And AFAIK Java does not even have a compacting GC.

      Placing stuff well in memory so as to minimize cache misses is of extreme importance to achieving high performance. All languages but C/C++ fail at this.

    31. Re:So True. by loufoque · · Score: 1

      Please avoid replying to what I said to say a comment about what someone else said. That is confusing.

      What is real is that Java on its best day is slower than C++ on its best day.
      Java being slower than C++ on its worst day doesn't really make sense, because I could make code as slow as I want in C++.

      A language being slow (and it depending on the day of the week) doesn't make much sense to begin with. A language may allow or prevent you to write the source code that is a good approximation of the fastest machine code.

  6. Is it open sourced? by Taco+Cowboy · · Score: 4, Insightful

    Is FB's JIT PHP open sourced?

    --
    Muchas Gracias, Señor Edward Snowden !
    1. Re:Is it open sourced? by PCM2 · · Score: 5, Informative

      Is FB's JIT PHP open sourced?

      It appears to be licensed under a combination of the PHP license and the Zend license. Both are BSD-like, but the Zend license has a clause that requires you to advertise for Zend if you advertise for a product built with the Zend Engine, which I don't much care for.

      --
      Breakfast served all day!
    2. Re:Is it open sourced? by Anonymous Coward · · Score: 5, Informative

      If it's not, back to Xcache or APC.

      Their "10 times figure" is absolutely correct though, in both Xcache and APC, the compiled binaries to take up 10 times as much space on disk and/or in memory, but to put things in perspective, that's caching memory. It was already consuming that 10 times size when being run directly from php before.

      Memory pigs like wordpress eat like 64MB of memory before you even get to plugins. Memory deduplication is required if you are running multiple blogs because the cache files generated by things like SuperCache and MaxCDN also eat up the opcode cache space.

      Fun times.

      #1 rule of php memory management: NEVER inline html. Many people use it as a easy way to do SSI, but this eats memory, opcode cache or not.

    3. Re:Is it open sourced? by nzac · · Score: 4, Informative

      Its on github and depends on open-source libraries.

      from the github page:

      HipHop is licensed under the PHP and Zend licenses except as otherwise noted.

      Its opens source but not copyleft/gpl and if you want to contribute to the project i think you have to sign over the copyright (need facebook login to see the agreement).

    4. Re:Is it open sourced? by MikeyO · · Score: 1

      A 4 digit ID and you can't make it to RTFA? :)

    5. Re:Is it open sourced? by Rennt · · Score: 2

      Yes. Code is up on github, a link to it cleverly hidden right there in the summary.

    6. Re:Is it open sourced? by ravenspear · · Score: 1

      or eaccelerator.

      I had stability issues with both xcache and APC on my production servers where things would go unexpectedly missing from the cache and throw nasty errors.

      No such issues with eaccelerator. very happy with that.

    7. Re:Is it open sourced? by ksd1337 · · Score: 5, Funny

      Hey, he's got a 4-digit UID! Respect your elders!

    8. Re:Is it open sourced? by Anonymous Coward · · Score: 0, Funny

      Yeah, I should be glad he doesn't have l33t sp34k in his name at least.

    9. Re:Is it open sourced? by Anonymous Coward · · Score: 0

      Or you could buy a license(s) of Zend and not have the requirement.

    10. Re:Is it open sourced? by Mad+Merlin · · Score: 1

      I had the opposite experience. When testing on some newer quad core servers (several years ago), I found that eaccelerator would cause segfaults in Apache that I couldn't pin down to anything in particular. It wasn't hardware either, because it happened on several machines equally. I ditched eaccelerator for APC and things have been peachy since.

    11. Re:Is it open sourced? by Anonymous Coward · · Score: 1

      >>If it's not, back to Xcache or APC.
      Any idea why they don't provide a PHP+APC benchmark?
      *hint*Probably because then their little creation suddenly doesn't seem all the fantastic anymore.*hint*

      Lately I'm seeing a lot of 'look-what-a-genius-I-am'-spam coming out of big companies in order to impress the management.

    12. Re:Is it open sourced? by cshark · · Score: 1

      Yes. I don't remember which license it's under though.

      --

      This signature has Super Cow Powers

    13. Re:Is it open sourced? by interval1066 · · Score: 2

      Hey, say what you want about fb, this news is a net Good Thing(tm). Its not bad that they add to the community and add something useful. And a JIT for php is a good thing.

      --
      Python: 'And then suddenly you have a language which says "we're all stuck with whatever the whiniest coder wants".'
    14. Re:Is it open sourced? by PCM2 · · Score: 4, Interesting

      The Zend Engine license seems contradictory to me. On the one hand, Clause 3 says you're forbidden from using the terms "Zend" or "Zend Engine" to endorse or promote your product. On the other hand, Clauses 5 and 6 say you're absolutely required to use the term "Zend Engine" to endorse and promote your product. Seems like someone took the classic BSD license and bolted a commercial land grab onto it, which seems to honor neither the letter nor the spirit of the original.

      --
      Breakfast served all day!
    15. Re:Is it open sourced? by youn · · Score: 4, Funny

      I believe it is a license meant for quantic processors... it is required and not required at the same time

      --
      Never antropomorphize computers, they do not like that :p
    16. Re:Is it open sourced? by MightyMartian · · Score: 2

      A good thing for the "community" would be if the library was cleaned up. Speeding up a trainwreck only makes the end result that much more catastrophic.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    17. Re:Is it open sourced? by Anonymous Coward · · Score: 0

      I believe it is a license meant for quantic processors... it is required and not required at the same time

      Seem legit!

    18. Re:Is it open sourced? by Tom · · Score: 5, Funny

      Pffft. Newbie.

      --
      Assorted stuff I do sometimes: Lemuria.org
    19. Re:Is it open sourced? by Anonymous Coward · · Score: 1

      Schrodinger Contract Claws?

    20. Re:Is it open sourced? by drinkypoo · · Score: 1

      Excellent. So now you have a license that you're always in violation of. And what happens if it is invalidated? Then you're left holding a piece of code to which you have no rights, since all OSS licenses are powered by copyright.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    21. Re:Is it open sourced? by TheRaven64 · · Score: 3, Insightful

      No, you must use your product to advertise theirs, you can't use theirs to advertise yours. It's the same as the old BSD license. You must include 'built using Zend's stuff' somewhere in your documentation, but you can't say 'really amazing because it uses Zend's stuff'.

      --
      I am TheRaven on Soylent News
    22. Re:Is it open sourced? by TheRaven64 · · Score: 0

      And a JIT for php is a good thing

      Is it? PHP has two problems: it makes it easy to write huge spaghetti projects that are expensive to maintain, and it's slow. If you make it fast, all that you do is encourage people to write even more spaghetti projects that are expensive to maintain. I suppose it's a good thing if you're a consultant...

      --
      I am TheRaven on Soylent News
    23. Re:Is it open sourced? by Hieronymus+Howard · · Score: 1

      Finally, a use for the <blink> tag.

    24. Re:Is it open sourced? by nahdude812 · · Score: 1

      Please define inlining HTML. Do you mean this: <?php /*...*/ ?>someHTML<?php /*...*/

      Or do you mean this: <?php echo "someHTML";

      Or both?

      Presumably you don't mean that every little bit of single-resource-specific markup should be a file read or database hit. The I/O requirements would ruin performance even with OS level disk cache available. I could see the case for low-usage large text blocks (such as a privacy policy or TOS) being in their own standalone file which if fpassthru()'d at runtime. But if it's not low-usage, it probably belongs in cache, and if it is low usage, the cache should be smart enough to notice this and expire it early. For example, APC keeps a hitcount on each file and expires the files with the lowest hitcounts when it's out of memory, and if that still causes you troubles, you can use filters to exclude paths you know don't benefit much from caching.

    25. Re:Is it open sourced? by DrSkwid · · Score: 1

      I've seen 1kloc C code with main() as the only function.

      Heck, just open any GNU C code if you want to see appalling code.
      ifdef nightmares

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    26. Re:Is it open sourced? by truthsearch · · Score: 2

      it makes it easy to write huge spaghetti projects that are expensive to maintain

      What language doesn't? Blaming PHP for poorly written code is like blaming a car for having a bad driver.

    27. Re:Is it open sourced? by Anonymous Coward · · Score: 0

      #1 rule of php memory management: NEVER inline html. Many people use it as a easy way to do SSI, but this eats memory, opcode cache or not.

      Can you explain this?

    28. Re:Is it open sourced? by deander2 · · Score: 1

      pffft. someone who was way to eager to give up his email address to some random web site in 1998. =P

    29. Re:Is it open sourced? by pdxer · · Score: 1

      Memory pigs like wordpress eat like 64MB of memory before you even get to plugins

      I think you may be exaggerating a bit, given that some people run WP blogs on VPSes with only 64MB of total system memory.

      --
      Looking for a job in Portland, Oregon?
    30. Re:Is it open sourced? by kriston · · Score: 1

      Not this old gag, again.
      *snerk*

      --

      Kriston

    31. Re:Is it open sourced? by sholdowa · · Score: 1

      No, the first thing you do is to dump apache, use nginx, and run in fpm mode. That way you can actually see what's happening.

    32. Re:Is it open sourced? by eigenstates · · Score: 1

      Weren't you my friend on some site somewhere?

      --
      quis custodiet ipsos custodes
    33. Re:Is it open sourced? by MikeBabcock · · Score: 1

      Actually, anything by DJB is both well organized and terrible to read at the same time. Also, never GNU licensed but still.

      --
      - Michael T. Babcock (Yes, I blog)
    34. Re:Is it open sourced? by Anonymous Coward · · Score: 0

      Obviously, because it should have read:

      FB's JIT PHP OSS?

    35. Re:Is it open sourced? by kmoser · · Score: 1

      That's insane. But of course we all know there's no sanity clause.

    36. Re:Is it open sourced? by kestasjk · · Score: 1
      endorse:

      1. To write one's signature on the back of (a check, for example) as evidence of the legal transfer of its ownership, especially in return for the cash or credit indicated on its face.
      2. To place (one's signature), as on a contract, to indicate approval of its contents or terms.
      3. To acknowledge (receipt of payment) by signing a bill, draft, or other instrument.
      4. To give approval of or support to, especially by public statement; sanction: endorse a political candidate

      i.e. the license says; you have to give us credit for our work, but don't claim we approve of your work.. Doesn't the BSD license itself contain a simlar clause?

      --
      // MD_Update(&m,buf,j);
    37. Re:Is it open sourced? by royallthefourth · · Score: 1

      Blaming PHP for poorly written code is like blaming a car for having a bad driver.

      That's why they make BMW's

  7. What's your problem? Very well documented! by syousef · · Score: 5, Funny

    And I quote:

    implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.

    What is your problem with this exactly? The functions do exactly what their name suggests. They will either make your head implode or explode!

    --
    These posts express my own personal views, not those of my employer
  8. old news by Anonymous Coward · · Score: 0

    hip hop has been open source for quite a while. At least a year.

    1. Re:old news by inglorion_on_the_net · · Score: 1

      hip hop has been open source for quite a while. At least a year.

      Yes. But this is not about the ahead of time compiler and the interpreter that were released back then, but rather about the new hhvm interpreter, which was released recently.

      --
      Please correct me if I got my facts wrong.
  9. I hate all languages that start with P by Maltheus · · Score: 2, Funny

    They're just not maintainable in my experience.

    1. Re:I hate all languages that start with P by Anonymous Coward · · Score: 0

      They're just not maintainable in my experience.

      Not even *sniff* Pascal?

    2. Re:I hate all languages that start with P by zero0ne · · Score: 1

      So:

      Pascal, Pawn, Perl, PHP, PL/I, Plus, Prolog, PureBasic, and Python ?

    3. Re:I hate all languages that start with P by zero0ne · · Score: 1

      Crap, looks like I missed a few.

    4. Re:I hate all languages that start with P by gregfortune · · Score: 2

      It's ironic how close P and R happen to be. Ruby fan, I take it?

      If not Ruby, what do you use for a scripting language? Please don't tell me you decided long ago that if it's possible to do everything in assembly, it must be done in assembly.

    5. Re:I hate all languages that start with P by Anonymous Coward · · Score: 0

      What I hate is when you write a non-P language, and they force a P-environment on you. You need Perl to compile a C program. Really??? It's always the build engineers doing this kind of thing.

      Then of course all the web guys want to use the P languages. It's more excusable; but I used to say, There's too much P in our software and spoken outloud in the midst of a rant that identified the problem, it made the point...

    6. Re:I hate all languages that start with P by Anonymous Coward · · Score: 0

      Brazilian coders disagree :D

  10. Hmm... by thestudio_bob · · Score: 1

    Can I "Like" this?

    --
    The real Sig captains the Northwestern. This one captains /.
  11. Real PHP Compiler by kervin · · Score: 2

    You can find a real PHP compiler at http://phpcompiler.org/. It would be nice if the official PHP engine had built in support for loading and running bytecode ( like JVMs ) instead of strictly text code.

    1. Re:Real PHP Compiler by Guspaz · · Score: 1

      Or Phalanger at http://www.php-compiler.net/ which is a GPL project that compiles to CIL bytecode, which is then run through .NET or Mono in a JIT fashion. It's a proper .NET language, so you get access to the .NET framework as well as the core PHP functions and default extensions. Unfortunately, some of the non-default extensions that they've ported (like gd2 or memcached) are not available in the GPL version.

    2. Re:Real PHP Compiler by cshark · · Score: 2

      Yes, but it's non standard. With Phlanger, you're mixing old extensions with known threading and security bugs with a weird namespace format, and an incomplete implementation. Then there's Studio integration, which is spotty. Didn't even support Studio 10 last I checked. If by "real" you mean, "runs half ass on .net" you're right. In terms of maturity, and in most other respects, it can't touch hiphop. Seriously man, try hiphop. It's amazing.

      --

      This signature has Super Cow Powers

    3. Re:Real PHP Compiler by loufoque · · Score: 1

      Is this one of those "compilers" that merely embed your files into a PHP interpreter?

    4. Re:Real PHP Compiler by Anonymous Coward · · Score: 0

      Or Here:
      http://code.roadsend.com/rphp

  12. Its not really JIT is it? by viperidaenz · · Score: 1

    the readme says its a source code transformer that converts php into c++ then compiles it with g++.
    How is that a JIT VM in any sense of the word?

    1. Re:Its not really JIT is it? by PCM2 · · Score: 2

      I think the Readme on GitHub is a placeholder. They took the Readme from HipHop, aka hphpc, which was the earlier project. This is HipHop VM, which is something different. Read the "more technical description," linked at the top, to get the picture. Basically, HipHop goes PHP-->Abstract Syntax Tree-->C++-->x64. HipHop VM goes PHP-->AST-->Bytecode, then runs the bytecode through a JIT.

      --
      Breakfast served all day!
  13. dev only by Fnord666 · · Score: 3, Insightful

    Unless I misunderstood the post, this is only being used in their development environments. It sounds like they are still using statically compiled php for production. They did mention that they hoped to closed they gap in performance between the two in the near future though.

    --
    'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
    1. Re:dev only by Zero__Kelvin · · Score: 1

      ... hoped to closed they gap ...

      The Hip Hop is wearing off on you my friend.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  14. Facebook should revamp itself first. by s-whs · · Score: 0

    "In its continuing endeavor to serve its 800 million users as quickly as possible, Facebook is once again revamping the way it handles its PHP-based Web pages.

    I've had a page made for me by a relative for business purposes and since then I visited a few pages on facebook related to my interests/business and I have to say, that I hate Facebook. Facebook is one of the worst pieces of crap I've ever seen. It's so unbelievably unintuitive, obscure and inconvenient (in all aspects, trying to set things for my own page, or looking at other pages, pictures, tehn going back, whatever), that it drives me nuts ever time I visit it (which is not a lot and I intend to keep it that way!)

    1. Re:Facebook should revamp itself first. by Anonymous Coward · · Score: 0

      What would be ironic, is if you are an OSX user.

  15. Sounds like a nice job by msobkow · · Score: 1

    Those are some very nice performance numbers the Facebook team achieved. Kudos. Time well invested.

    One of these days I need to write a compiler for my own stuff. Re-interpreting strings a few thousand times is the next big optimization opportunity I have for my core library. Eliminating that re-parsing should garner a nice performance improvement, though I envision compiling to a set of runtime objects rather than actual bytecode or native Java source. Faster than p-Code or a non-JIT JVM, but not as fast as it could be if I went crazy optimizing things.

    --
    I do not fail; I succeed at finding out what does not work.
  16. Sorry, I can't trust that code by Anonymous Coward · · Score: 0

    With all the privacy problems from Facebook, who's to say they didn't add Facebook-cookies tracking code in there, to increase their control over their users from other websites?

  17. Great stuff Facebook! by hesaigo999ca · · Score: 1

    They should offer this as a platform to other websites, and developers that want to maintain and leverage the advantages of using this JIT compiler vs the other one....
    If they are saying "we just recreated a php that is faster and more performing than the original" I would say yay!!
    Facebook could just buy PHP and say it owns the language, if they have enough money, no?

  18. PHP is a toy compared to what is out... by Anonymous Coward · · Score: 0

    Everytime I log in to FB I lament as to how these guys reached 750 million users (or what are the fake numbers yet?) with such a shitty, lame, mediocre, underperforming and buggy piece'o'crap.

    Then I remember it's PHP. Yeah, right.

    I'm using freakin' "websites" that are more complex than quite a lot of applications nowadays (no, /. ain't one of them) and the only sure I can be sure of is that they weren't developed by "webdesigners" knowing how to cargo-cult some PHP crap.

    1. Re:PHP is a toy compared to what is out... by krinderlin · · Score: 1

      I haven't had a buggy experience since they moved to HipHop generated C++. Then again, I don't play cow-clickers or wall-posters either (aka apps). That's where most the complaining comes from, the part where everyone and their mother writes some piece of crap to harvest your data in exchange for posting some pixels on your wall for you. :-)

  19. Quercus PHP? by sprins · · Score: 1

    Why don't they use (invest in) Quercus on Java instead? Compiles PHP to Java classes (like JSP) and works blazingly fast: http://caucho.com/resin-3.1/doc/quercus.xtp#compiling

    I wonder why we don't here more about Quercus in the PHP world...

    1. Re:Quercus PHP? by royallthefourth · · Score: 1

      I wonder why we don't here more about Quercus in the PHP world...

      Well, it's right here in your link:

      This is available only in Resin Professional.

      That's $700 per CPU. Precious few PHP shops are willing to actually pay for software. The ones that do, like the one I work at, still aren't going to jump at $700 for server improvements, especially if they're esoteric and the developers barely understand how to use them.

  20. amusing image by Anonymous Coward · · Score: 0

    For some reason I find this image from the last link amusing... could it be the naming convention? Or the combination of a particular function name and argument name?

    http://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/385994_10150437163692200_9445547199_8439695_1870185023_n.jpg