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.
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.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
The first 90% of the hhvm project is done; now we're on to the second 90% as we make it really shine.
Is FB's JIT PHP open sourced?
Muchas Gracias, Señor Edward Snowden !
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
They're just not maintainable in my experience.
Can I "Like" this?
The real Sig captains the Northwestern. This one captains
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.
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?
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
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.
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.
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?
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...
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. :-)