LWN.net Logo

Facebook's "HipHop Virtual Machine" released

Facebook has announced the release of the HipHop Virtual Machine. "So, early last year, we put together a small team to experiment with dynamic translation of PHP code into native machine code. What resulted is a new PHP execution engine based on the HipHop language runtime that we call the HipHop Virtual Machine (hhvm). We're excited to report that Facebook is now using hhvm as a faster replacement for hphpi, with plans to eventually use hhvm for all PHP execution." They claim some significant speed improvements; the announcement has a fair amount of detail about how it works. The source is available from Github.
(Log in to post comments)

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 16:34 UTC (Mon) by flammon (guest, #807) [Link]

It's nice to see ex Mozilla developer bring FOSS goodness/culture to Facebook.

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 17:15 UTC (Mon) by dashesy (subscriber, #74652) [Link]

While reading the announcement I get this:
"Not Logged In\n
Please log in to continue."

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 17:26 UTC (Mon) by corbet (editor, #1) [Link]

That is most strange...I don't even *have* an account with that particular site, so could not have possibly been logged in when I read the announcement.

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 17:31 UTC (Mon) by bo (subscriber, #56215) [Link]

I do not have an account there either, but could read the announcement just fine.

Maybe there's some cookies left over from when someone (else?) logged in there?

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 17:45 UTC (Mon) by dashesy (subscriber, #74652) [Link]

When reading, I am used to highlighting the text.
I guess it happens when reading the comments section (it is sporadic)!
I cleaned the cookies, and it seems hovering the mouse over the comments section also some times displays the same popup dialog.

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 21:06 UTC (Mon) by proski (subscriber, #104) [Link]

It's caused by hovering the mouse over diagonal crosses ("report spam") next to the comments. That's apparently a Facebook bug.

Facebook's "HipHop Virtual Machine" released

Posted Dec 19, 2011 11:37 UTC (Mon) by ender (subscriber, #13629) [Link]

I'll try to get a repro and report it internally, thanks!

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 18:00 UTC (Mon) by imgx64 (guest, #78590) [Link]

The dedication of Facebook folk to PHP is astounding. I mean, when Twitter had performance problems with Ruby, they replaced it with Scala, and Ruby is a generally liked language. Yet, Facebook developers decided to develop a compiler and a VM for a generally despised[1] language.

[1] I apologize for the flame bait, but I have never met any person who actually likes PHP. It's like Visual Basic; it only gets used because many people learned it as their first language and never looked beyond it.

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 19:22 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

I've met one person who used PHP as others would use shell scripting. Nevermind that approximately none of the CS machines had php-cli installed. Not sure what he did when shelling into them.

Facebook's "HipHop Virtual Machine" released

Posted Dec 13, 2011 13:41 UTC (Tue) by jond (subscriber, #37669) [Link]

cronjobs calling wget? We spent a long time unpicking that nightmare in my former job.

Facebook's "HipHop Virtual Machine" released

Posted Dec 13, 2011 16:53 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

No. What normal sysadmins would script in bash, he would write in PHP instead. From small tools for batch processing to complicated scripts.

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 20:03 UTC (Mon) by hingo (guest, #14792) [Link]

FWIW, I like PHP. I smile when I go to a Perl conference and people diss PHP for being messy. I could see why *someone* would criticize it like that, but hey, *you* are writing Perl for a living. When Pythonistas are so proud about their nice object oriented language, I think to myself, but wait, that's the language where you have to actually type the "this" object, no wait it's the "self" object, into each method's argument list...

Java of course is a completely different matter. Very nice language, but hurt fingers very much to type so many words...

So yeah, PHP could have been better and nowadays it is much better than 3.x series, but if you look at the alternatives, you might appreciate it more.

FWIW I think out of all of this accidentally cobbled together scripting languages, JavaScript is surprisingly clean and consistent and I can see it having a bright future also server side. (But using + for string concatenation is perhaps it's major fail.)

Facebook's "HipHop Virtual Machine" released

Posted Dec 12, 2011 21:49 UTC (Mon) by dashesy (subscriber, #74652) [Link]

Java of course is a completely different matter. Very nice language, but hurt fingers very much to type so many words...
At first having a nice IDE was just fun, but now the first thing I do before the very first main() is that I setup an environment with a nice and fancy IDE. This is specially useful for Java, when IDE integrates well with compiler. Last time I used Eclipse for Java I hardly had to type anything! (yes maybe just once for declaration). One may prefer vim and big tags, also makes life very pleasant.

Facebook's "HipHop Virtual Machine" released

Posted Dec 13, 2011 10:39 UTC (Tue) by hingo (guest, #14792) [Link]

Yes, now that there are more good IDE's than just Visual Studio, I completely agree and would use Eclipse a lot if I did a lot of work in Java.

What other language can you name...

Posted Dec 12, 2011 22:31 UTC (Mon) by khim (subscriber, #9252) [Link]

So yeah, PHP could have been better and nowadays it is much better than 3.x series, but if you look at the alternatives, you might appreciate it more.

Are you sure? Out of popular contemporary languages two are the worst by far: PHP and JavaScript. Well, bash is close (if you want to call it "programming langauge").

The problem is not in some language constructs but in the very core of these languages. They were designed to "help" the developer. If construct makes no sense (for example if you try to compare integer and string) then PHP and JavaScript try to do "something sensible". The end result is disaster. When your language can declare that "A == B", "B == C" yet "A != C" or if asseritions "A < B", "B < C" and "C < A" are all true... it's hard to be sure in anything. Well, you can use === exclusively (but this makes PHP similar to bash where natural thing creates problems and proper thing look unnatural), but there are no easy solution to second problem.

JavaScript is necessary evil: it's impossible to do any web programming without JavaScript. But PHP... just say no. Easy and simple.

P.S. You may say that C exhibit similar idiosyncratic behavior when floating point is involved. Sure - but floating point is pretty hard to do right in any language. This is well-known problem with similarly simple solution: use fixed point where you can floating point where you must and be extra careful if you do. In PHP it does not help you much...

What other language can you name...

Posted Dec 13, 2011 16:54 UTC (Tue) by jmm82 (guest, #59425) [Link]

I have been programming regularly in PHP for the past five years and for web development this is rarely an issue. Every language makes trade-offs and PHP allows quick code to be written that does what you want more often than not. Obviously, I would not want to use PHP for mission critical code, but I also wouldn't want most web developers in the real world writing code in a language like C.

What other language can you name...

Posted Dec 13, 2011 20:31 UTC (Tue) by user337392819 (guest, #75347) [Link]

"Obviously, I would not want to use PHP for mission critical code, but I also wouldn't want most web developers in the real world writing code in a language like C."

Perhaps not, but I *would* like to see more web developers endeavoring to learn and understand C, as that would go a long way towards alleviating your apprehension about using PHP in mission-critical scenarios.

What other language can you name...

Posted Dec 13, 2011 21:06 UTC (Tue) by jmm82 (guest, #59425) [Link]

Please explain what you mean. Maybe mission critical was not the correct word.

What other language can you name...

Posted Dec 14, 2011 9:43 UTC (Wed) by mpr22 (subscriber, #60784) [Link]

From the point of view of a web developer, the website's user-facing functionality isn't just mission-critical, it's the mission.

Facebook's "HipHop Virtual Machine" released

Posted Dec 13, 2011 9:48 UTC (Tue) by mpr22 (subscriber, #60784) [Link]

So yeah, PHP could have been better and nowadays it is much better than 3.x series, but if you look at the alternatives, you might appreciate it more.

At first, I was rude about PHP because I heard so many security horror stories. Now, having used it, I am rude about PHP because I have seen it for what it is: a vessel of fertilizer.

(All of its good features can be found elsewhere, and most "elsewheres" have less annoying bad features.)

Me like PHP

Posted Dec 13, 2011 22:46 UTC (Tue) by man_ls (subscriber, #15091) [Link]

I like PHP too. To my surprise, I should add. I have written code in a lot of "serious" languages, and I always thought that PHP was the equivalent of ASP. Now that I know it it can be messy, comparisons are horrid, there are hundreds of primitives, many types of null... and yet the class model is nice, the syntax is mostly consistent (except where it's not), and it generally does what you want. It has everything you want and somehow it mixes well.

Reminds me of the Friends scene where Joey is eating a cake which mistakenly contains custard, beef, fruit and whatnot:

I like it! I mean, what's in it not to like? Jam? Good! Custard? Good! Meat??? Gooood!!!
And JavaScript, well, you call it clean but for me it's the king of messiness. Its object model (prototypes) is completely horrid, you can mix functions and objects (associative arrays in fact) in a thousand ways. And yet it somehow rules! Furthermore, it has achieved what Lisp and Python failed to do: it has brought functional programming to the masses (in the form of callbacks).

I do not miss Java or (gods forbid) C in the least.

Facebook's dedication to PHP

Posted Dec 13, 2011 22:49 UTC (Tue) by rfunk (subscriber, #4054) [Link]

It is interesting. It's gotta be because of the sheer quantity of PHP code that Facebook has. Twitter couldn't have had nearly as much Ruby code.

Partly because Ruby is so much more concise....

(So you know where I'm coming from, I'm mostly doing Javascript and some PHP these days, and used to do lots of Ruby. And I do know people who love PHP, but they're weird.)

Facebook's "HipHop Virtual Machine" released

Posted Dec 16, 2011 0:59 UTC (Fri) by sumanah (guest, #59891) [Link]

MediaWiki's Tim Starling on the effect this has on Wikimedia's plans:

http://lists.wikimedia.org/pipermail/wikitech-l/2011-Dece...

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds