Hacker News new | past | comments | ask | show | jobs | submit login
Wikipedia on HHVM (hhvm.com)
193 points by jamesgpearce on Jan 6, 2015 | hide | past | web | favorite | 56 comments

They note that 5.6 has some substantial performance improvements over 5.3. I'd point out that PHP 7, coming out later this year, will be even faster (perhaps as much as 2x 5.6), since some very smart people have done some big internal refactoring in the Zend engine, largely to reduce allocations, pointer indirection, and memory usage. These efforts combined have resulted in pretty big performance gains, making PHP 7 more competitive with HHVM performance-wise. In addition, writing PHP extensions is somewhat nicer now.

Zeev Suraski (one of the original two Zend Engine authors along with Andi Gutmans, also co-founder of Zend, Inc.) did some benchmarks:



However, bear in mind that those benchmarks were faked* by Zeev, a Zend Engine proponent. Benchmarks faked* by HHVM engineers might show a larger gap. ;)

* I'm not using "faked" in its normal sense. They probably weren't fraudulent, but I am a believer that we should say "fake a benchmark" and not "make a benchmark" given that they can be so circumstantial and misleading: http://blog.ajf.me/2014-10-23-on-benchmarks

Disclaimer: I am, myself, biased towards the Zend Engine, I'm a php-src committer.

I make a point to say "synthetic benchmarks" for such circumstances. It clearly conveys that the benchmark is contrived, likely to demonstrate a particular point, but it avoids the negative connotations.

Ah, that's a good term for it. I like "faked" because it has added humour value (it's rather "ha ha only serious"). Without using a disclaimer around it, though, someone will probably smack me.

Use `fake' in speech, where you can convey more context, and `synthetic' in writing?

I'd say the other way around, honestly. In writing I can stick a * there so it's obvious that there's more to it than it seems. In speech, unless it's explained beforehand, it might not be a good idea.

I really thought that when you wrote "faked" that reflected on Zeev's character. That he was trying to pull a fast one. Only after encountering the disclaimer did I realize what you meant. Many people won't read the disclaimer, and therefore when dealing with someone's reputation you should pick a word which might avoid misunderstanding.

Fair point.

I might say some things about Zeev, but I certainly wouldn't say he's a liar. He's a talented developer.

Saying someone's faked a benchmark is an extraordinarily serious accusation of professional malpractice. I think your little joke is a very misguided.

Having seen how the sausage is made at many performance oriented companies this seems to be a bit of an overstatement.

Air-quotes? Or just stick to boring words.

I think that techempower is a neutral third party yet they show php having a huge advantage over hhvm[1]

[1] : https://www.techempower.com/benchmarks/

That's JSON serialisation, it may just be that HHVM has a faster JSON library.

hhvm is still far faster and generally uses less memory. The development pace is also much faster. Zend is on the outs, and that's a good thing.

Hooray! I'm a massive fan of HHVM, though not just because it's so fast: Hack is something I'm really interested in. The collections libraries in the stdlib are brilliant to use, and the static typing makes writing some types of code easier and keeps some bugs out of my codebase. The only thing I wish to see is more editor/IDE support for it, so I helped contribute to hack-sublime and have been writing my own plugin for Komodo Edit/IDE.

HHVM and Hack were the impetus for me to learn OCaml, which is a lovely language. It's good to see more and more places picking up HHVM, and it's also great to see PHP5.6 and 7 increasing performance drastically, too!

Congrats to FB for donating their engineering resources to helping Wikipedia. How do we make this more the norm for large corporations with talent? Something akin to Google's 10% time but with a social-good focus? It might help silicon valley's reputation in a larger sense.

Bear in mind that Facebook has a vested interest in getting other large sites to use HHVM, so that they're not the only ones who want to maintain it. They're not doing this purely for the greater good.

That said, I agree, Facebook is doing awesome stuff here.

Just to underscore your point: I'm an engineer at Wikimedia, and I worked quite closely with Brett, the author of the blog post. As a small nonprofit operating a very popular site, we're accustomed to being approached by salespeople camouflaged as altruists, and over the years we've developed a pretty good nose for that sort of thing. The people on the HHVM team with whom I interacted were palpably genuine and nice, helping us out at odd hours of the night, and asking for absolutely nothing in return. They're wonderful people, full stop.

> so they're not the only ones who want to maintain it

Being completely unaffiliated with Facebook, I think this still counts as 'greater good' for many.

Sure. I'm just saying that they have business motives to do so, it is not merely out of the kindness of their hearts. Though I am sure it is also partly the latter, they have some wonderful engineers. :)

As far as I'm aware, HHVM isn't something that FB is charging for. If that's true, what's the business interest?

The same one I mentioned before: getting other people to use it benefits them, as other people will help maintain it because they also have a stakehold in its success. It's a huge project to maintain.

If you define it that way then there's almost nothing in the world that would categorize as altruism. Helping kids in Africa? It's only to make yourself feel good. Helping that fallen granny get up? It's to make yourself look good in front of others. Etc. If you go that far, both egoism and altruism will have completely lost their meanings.

>Helping kids in Africa? It's only to make yourself feel good. Helping that fallen granny get up? It's to make yourself look good in front of others.

Exactly! Of course we do things to make ourselves feel good. And since helping other people makes us feel good, why shouldn't we be honest about our motives? It's win-win.

Is it a huge project to maintain? I thought the first HipHop implementation was a 2-person side project. Relative to FB's size, does it matter even if they had to put 10 people on it?

Originally, yes, but it's grown since then, and bear in mind that it is critical infrastructure that Facebook are now completely dependant on.

The other business interest is... as it gets more adopted, more people will know the ins and outs, and the talent pool for them to pick from will grow.

More other businesses using it also makes it harder for people to make the argument against it as "it's just a Facebook thing"

Yes. It's probably hard to hire developers if they must program in an obscure internal-only dialect of PHP (Hack).

That comment got downvoted to -1! I'm not saying Hack is obscure and used only by Facebook - but it would have been had Facebook not open-sourced HHVM and tried to promote its use.

It's not that obscure. Anyone with an ounce of experience in PHP can start writing solid Hack on day one. And that would still be true even if Hack were never seen in the wild.

Unless you think it's hard changing the open tag from <?php to <?hh :p

I'd be surprised if anything-PHP is a bonus to hiring. Most likely people work on it despite of PHP, not because of it.

No, many people work on it because of PHP - because of the speed and flexibility of dev with it.

I've done PHP, some Ruby, some .NET, Java and more - coming back to PHP is often fun and a breath of fresh air. Nothing's perfect.

Um, this is literally the open source process. This is how it's supposed to work.


That is even better! Because that creates incentives to continue supporting it.

In the last several years I've spoken to libertarians, conservatives, progressives, various schools of economics etc. It's become clear to me that when platforms are free, more wealth is created. When Netscape open sourced their codebase, we got Firefox and WebKit. Linux, Webkit, WikiWikiWeb, Git, in fact all those image formats you can display without paying royalties or risking getting sued, obviously led to more wealth creation than proprietary siloed codebases. Eventually even MS opensourced their platform, after years of copying by Mono.

I think a better example would be Btrfs. Facebook hired the lead Btrfs devs and they are still contributing to Btrfs development. And this is because Facebook is very interested in Btrfs themselves.

This is great news to see. I have tested HHVM with our particular application load and I found it to be a bit tricky to tune just right. However PHP 5.6 has been solid in production for us handling 5 billion requests daily.

Wow. What are you running that's getting 5 billion requests daily?

Mobile Ads and Mobile Analytics for about 500 million devices world wide.

The y-axis of the first graph should start at 0. Being more than twice as fast is quite a lot. There is no need for cheap tricks.

If you aren't visualizing tiny deltas, don't truncate the y-axis. It's misleading.

That was just the default presentation mode of the tool I got the graph from. It's been updated.

Thanks. Graphs are so much better without "fine print".

The results would have been very interesting if they switched from PHP 5.6, but switching from 5.3 to HHVM is impossible to know how much of the improvements are due to the newer PHP and how much to HHVM. Nevertheless, Wikimedia must be really satisfied.

how does HHVM compare to PHP 7 in terms of speed savings? PHP 7 is supposed to be pretty damn fast from what I have seen. I guess benchmarks are hard to read because they're dependent upon a lot of factors. It would be interesting to see two sites at similar scales running competing engines for PHP (hhvm vs. PHP 7).

Minor point of style: We tend to refer to phpng in lowercase, because that's the branch name. Although at this point, since it no longer exists as a branch (it's long since been merged into trunk) and there have been subsequent performance optimisations, the names "PHP 7" or "Zend Engine III" are possibly better.

Also, I partly responded to this above: https://news.ycombinator.com/item?id=8848129

TIL, thank you for that.

I have seen anywhere from 100% to 50% faster, with lower memory usage overall.

Thank you to both Wikipedia and Facebook for being transparent and sharing this back to the open source community. It's these type of joint efforts that really move the web forward. Hats off.

Intersting, I didn't realize PCRE now has JIT support. http://sljit.sourceforge.net/pcre.html

Also, that page points to Apple's YARR, which I didn't know about either (and Chrome's irregexp, which I did).

Might somebody be willing to explain the difference between the two versions?

> using HHVM from GitHub rather than our internal repository.

The only differences are some Facebook-only extensions we use to interface with internal services, and a different build system. The code is exactly the same otherwise.

I would love to use hhvm, unfortunately my IDE of choice PHPStorm doesn't support it yet :( despite a big long list of customers requesting it. https://youtrack.jetbrains.com/issue/WI-21737

What editor do Facebook and Wikipedia use for their HHVM/PHP development out of interest?

edit: downvoted? really? for what?

I use vim. Other MediaWiki developers use emacs, PHPStorm, TextMate, Notepad++ or whatever editor or IDE the individual developer is most comfortable with.

"Peak CPU utilization dropped from about 70% to 12%, almost a 6x improvement."

That is substantial, and HHVM should bear to rest some of the claims (trolls) that PHP is not performant.

That you can claw back some performance by using a partially conforming alternate language implementation does not prove the "trolls" wrong.

Yes, with enough engineering effort you can move mountains, but if performance is critical and you don't have a legacy code base like Facebook does, reaching for the php hammer is insanity.

The real reason why performance isn't a big downside with php is that it usually just doesn't matter.

If a php implementation can service 100 req/s, and a Java implementation (an ad absurdum) 100,000 req/s, and your site peaks at 5 req/s, either is just fine.

In other words, "You're probably not Pintrest".

> That you can claw back some performance by using a partially conforming alternate language implementation does not prove the "trolls" wrong.

You're talking as if PHP is slow. It isn't, it's very fast, speed is actually one of its advantages (or was historically, anyway). Its alternatives (Python, Ruby) are sometimes marginally slower. With its next release, it will receive a significant performance boost, and minor versions usually include small but significant performance gains.

Yes, it's not as fast as say, C, C++, Java, C#. It doesn't need to be, nor does anyone expect it to be: it's a dynamic language that allows for rapid development. But to talk about it like it's something horribly slow that you'd never use in 2015 is simply wrong. It is competitive.

PHP performance is/was not a reason to not use it, if there was ever a reason you'd be "insane" to do so. Pinterest runs on a "slower" Python/Django stack, for that matter.

HHVM is a completely new interpreter, so it has nothing to do with the Zend interpreter's performance.

That said, PHP is (and has been) faster than both Ruby and Python and does some things faster than Perl. It shouldn't be expected to compete with Java or Go.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact