Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
HHVM's Profile-Guided Region JIT (hhvm.com)
40 points by Cozumel on Feb 18, 2017 | hide | past | favorite | 10 comments


I was honestly surprised how well PHP7 fared against HHVM. No JIT, and likely a much smaller team and budget. Most of the comparisons I've seen show them as roughly the same performance.


PHP7 was a huge performance leap over 5.x, I saw all the benchmarks and they looked impressive (100% performance, 50-80% reduction in memory usage) and expected the usual "Ok but in the real world I'll get maybe 10-20% because benchmarks" and nope, in production I see exactly what the 5 vs 7 benchmarks show.

The memory reductions when dealing with large arrays (pretty much the only datatype in PHP...) are colossal.


> arrays (pretty much the only datatype in PHP...)

linked-hash-map-arrays, they are :)


Unless HHVM team does something surprisingly good with their next version PHP 8 will surpass it in performance for sure considering it will have JIT and probably other bells and whistles.

On the other hand the HHVM team had to reimplement a lot more code that php 7 had ready from 5.6.


php7 got rid of all the refcounting overhead while hhvm still have to decide when it can turn it off.

php7 reduced all its data structures significantly. nowadays slimmer data structures are much more important than cpu.


Has anyone tried building a PHP runtime based on Truffle?

It might not be as fast as a dedicated JIT with a big team behind it, but it seems Facebook's HHVM effort is relatively small as these things go.

Is there anything about PHP that would make Truffle a bad fit? I ask this as someone who knows next to nothing about either PHP or Truffle!


>Is there anything about PHP that would make Truffle a bad fit?

Perhaps one barrier would be the insane number of built-in functions. There's 1000+[1]. And, as far as I can tell, most of them tied to underlying C code versus being written in PHP themselves.

The other might be that because of the built-in templating thing, you would have to parse html as well, to find the embedded PHP. I'm not sure how well that aligns with Truffle's approach. Things like this:

  <ul> 
    <?php foreach ($foolist as $foo) { ?> 
      <li><?php echo $foo;?></li>
    <?php } ?>
  </ul>
[1] Try: php -r 'var_dump(get_defined_functions());' | less


Built-in functions are certainly a pain. They pose a similar problem for Ruby (which there is a Truffle implementation of). I think the best way around is to rewrite them in PHP, but it may not be tractable to do this with the same semantics. Another option is to run the C code that implements the builtins using the same JIT as you use for the PHP code. Then you can inline through the builtins, which is one reason why HHVM may be slow.


Here is a link to Truffle, because it's not easily googleable: https://github.com/graalvm/truffle

Interesting project. Maintained by Oracle, though.


A big team behind would certainly guarantee over-architecture and slowness. Just compare the various team sizes of slow and fast dynamic languages.




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

Search: