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!
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.
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.
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!
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.
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
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.
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.
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."
Hey, he's got a 4-digit UID! Respect your elders!
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.
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.
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
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.
Pffft. Newbie.
Assorted stuff I do sometimes: Lemuria.org