
Coming Soon in HHVM - jwatzman
http://hhvm.com/blog/8405/coming-soon-in-hhvm
======
girvo
Yay! I'm so excited to use the `async` methods in production with MySQL. The
biggest bottleneck for our PHP apps can now have a workaround in some cases,
that's brilliant.

 _> Integration of LLVM as a further optimization step to make the hottest
code run even faster on HHVM._

These multistage JITs are absolutely fascinating, I believe Safari is doing
something similar with Javascript. Intuitively I would've assumed the overhead
of firing up yet another JIT and VM to run it on would make it not worth it,
but I guess the instructions currently generated are so far off optimal that
it _is_ worth doing.

EDIT: Anyone know of any papers regarding multi-stage JITs that I can check
out?

~~~
rll
Async MySQL queries have been available to you in PHP since PHP 5.3.0 released
in 2009:

    
    
        http://php.net/mysqli.poll
    

If that has been your bottleneck, why haven't you been using them?

~~~
jwatzman
The async support you linked, while useful, isn't really the same thing. It
requires explicit, manual coordination between different parts of the code
that want to fetch data. You're responsible yourself for batching fetches,
polling, and running other code until the results are returned.

With Hack's async support, the runtime manages all of this for you. You call
"await $query", and then your function is suspended until the data is
available. Other code automatically runs until it too hits an await statement
-- which might block it on MySQL, memcache, curl, or anything else, with no
extra manual coordination needed. The runtime manages it all for you.

[http://hhvm.com/blog/7091/async-cooperative-multitasking-
for...](http://hhvm.com/blog/7091/async-cooperative-multitasking-for-hack) has
some examples for what this looks like with curl -- in the final example,
notice how you can just "await" on a bunch of different things and let the
runtime worry about coordinating all of them.

~~~
girvo
^^^ What he said :)

The async stuff in HHVM is far more powerful than the meagre-at-best support
for asynchronous operations in the original PHP runtime. In usage, HHVM's will
be much more powerful.

------
Xorlev
I wonder how long it'll be before HHVM starts driving the PHP project,
implicitly or explicitly.

------
joesmo
I'm rather disappointed that full, non-experimental xdebug support isn't on
this list. I can't think of a more pertinent feature. I like HHVM's
development as well as Hack, but without proper remote debugging, it remains
rather inaccessible. I would personally love to contribute to getting some of
the major frameworks that are not quite 100% compatible up to par but have
been deterred in being able to fix bugs in a timely matter because of the lack
of debugger support.

~~~
jwatzman
It's not on the list since it was released a few versions ago! Try it in the
latest stable version, and please file issues on GitHub if you run into
problems. There are already a couple of known issues filed there that are
being looked into, but at least the PHPStorm developers have told us that it
works well enough they are able to work on XDebug+HHVM support in their IDE.

~~~
joesmo
Awesome! I must've missed the announcement (if there was one). I'll definitely
be checking it out soon.

------
pilif
I have recently tried out to run our huge, about 10 years old application
using HHVM. Interestingly enough, aside of few 5.6 features it didn't support
yet, the process was surprisingly painless.

However, HHVM was generally between 2 and 5 times slower than vanilla PHP at
rendering pages. In micro benchmarks it was way ahead, but running the whole
application was a very different matter.

I decided to wait until the thing matures a bit more before trying again and
then hopefully with more time to investigate the causes of this huge
difference in performance.

~~~
andrewchambers
Did you run enough requests to allow the jit to work? some jits require
thousands of runs (in this case requests) to warm up.

~~~
pilif
I would hope ab -c 5 -n 1000 would be enough. I've used -c 5 because the VM
wasn't exactly beefy, but that's still quite a few requests.

~~~
fredemmott
do you have any profiling information to share? if you could post it as a
github issue, we'd be very interested. This sounds unusual.

~~~
fredemmott
also, if this is an open source workload, any chance you could submit it to
[https://github.com/hhvm/oss-performance](https://github.com/hhvm/oss-
performance) ? We generally optimize based on those benchmarks, and Facebook
itself.

------
mrmondo
Any sign of official PostgreSQL support?

------
nodesocket
We just need the Mongo extension ([https://github.com/mongodb/mongo-php-
driver](https://github.com/mongodb/mongo-php-driver)) to be supported to try
HHVM out.

~~~
fredemmott
People are having lots of success with
[https://github.com/mongofill/mongofill-
hhvm](https://github.com/mongofill/mongofill-hhvm)

------
bsaul
Sorry for yet another rant against php, but does anyone else here feels a bit
sad that those obviously brilliant people work so hard to improve this
language instead of basically any other main one ?

Edit : seems like i wasn't clear. I don't mean sad for the people working on
the project ( i'm sure they love what they're doing), i mean sad because as a
non-php dev ( but basically everything else dev), i know many "better"
languages that would benefit from having those kind of people on board.

~~~
skore
HHVM is the answer to the following conversation:

P1 - "PHP sucks, it's a terrible language with no proper design and no serious
person would ever want to use it"

P2 - "But tons of large projects are built on it and people ship with it
everyday"

P1 - "So? It's still terrible"

P2 - "What do you think is so terrible?"

P1 - "Oh lots and lots of things, I wouldn't even know where to begin"

P2 - "How about this: let's throw boatloads of cash on it for a while and see
where we get."

P1 - "Oh gee, I dunno if..."

P2 - "Boatloads of cash it is.

[edit] After seeing how my comment could be seen as ridiculing HHVM: I'm a PHP
dev and I'm loving every second of what they're doing. I think they're right
on the money.

~~~
tracker1
I actually appreciate the work that Facebook is doing in this space... it's
definitely beneficial to those running PHP codebases that have been around a
long time. While I don't like PHP the language, I can understand the utility
of it.

That said, I'm appreciating the move to containerization and micro-services
more... replacing some pieces with better options becomes far easier when
those pieces are smaller. I can prototype in something like node, and move
those troublesome bits to something like go or c++ if needed.

