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.
I'd like to launch this discussion by making a snide remark about PHP.
Breakfast served all day!
Da Hip Hop PHP compila is in Da House! Respect bitches!
These posts express my own personal views, not those of my employer
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.
Is FB's JIT PHP open sourced?
Muchas Gracias, Señor Edward Snowden !
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.
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.
And I quote:
Slashdot is proof that Sturgeon's Law applies to mankind.
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.
And I quote:
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
http://en.wikipedia.org/wiki/Ninety-ninety_rule
Often wrong but never in doubt.
I am Jack9.
Everyone knows me.
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.
It's a form of hacker koan. In your eagerness to be a smartass you failed to reach enlightenment.
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.
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".
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.
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.
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
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.
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/
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.
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!
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
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
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
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.
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.