-1

Ok, so i really do want to use and believe in HHVM however in every test I perform HHVM is coming out slower than PHP. I have run many many different test some very complex scripts with lots of processing to simple scripts. For demonstration I shall show you the results with a (really) simple script.

public function hhvm(){
  $list = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);

  $this->benchmark->mark('code_start');

  for ($i=0 ; $i<100 ; $i++) {
  serialize($list);
  }

  $this->benchmark->mark('code_end');
  echo $this->benchmark->elapsed_time('code_start', 'code_end');
}

Both HHVM and PHP are running on the same server in CLI: System is...

  • Ubuntu 14.04
  • 4 SSDs in RAID 0
  • 2x Hexcore Xeons
  • 64GB Ram
  • Codeigniter 3.0 (framework)
  • PHP 5.5.9
  • HHVM (Latest stable release as of 2/7/2015)

This script run 20 times under each of the below commands with the following results:

"hhvm /var/www/vhosts/test.local/httpdocs/index.php test hhvm"

Average execution time = 0.0021

"hhvm -v Eval.Jit=1 -v Eval.JitProfileInterpRequests=0 /var/www/vhosts/test.local/httpdocs/index.php test hhvm"

Average execution time = 0.0020

"php /var/www/vhosts/test.local/httpdocs/index.php test hhvm"

Average execution time = 0.0003

Obviously this is a small script, i have ran much much larger scripts through it and the times i were seeing were PHP = 5.2s HHVM = 6.4s which doesn't seem a lot but when you have too many of these running it all adds up.

So my question is.. What the hell am i doing wrong? Why can i not set HHVM to run quicker than PHP. (is it an incompatibly with CI3.0? even though the HHVM site says 100% compatible?)

EDIT: So after searching and searching it seems nobody can provide an answer, I have tested without the CI3 frame work using just standard PHP and the results are pretty much the same, I have asked 3 others on different forums to test and they get exactly the same results. I conclude that HHVM is a load of hype and in real world scenarios it just doesnt cut the mustard. If there is anyone out there than can prove me wrong I would love to hear from you as, in theory, HHVM sounds amazing and I would love to use something that optimises the execution of code as much as it claims to do.

Kirk
  • 11
  • 3

1 Answers1

1

I ran into poor performance of hhvm I never compared it to normal php but in my case it was caused by the fact that error logging was on by default in the php.ini. When i turned it off the performance improved a lot.

Another thing is that you turned off warm up requests. This feature was for optimzation reasons.. In some occasions it might help to turn this value up a bit and run it multiple times first.

THere is also a chance that codeignighter cause the problem. Running things on global scope seems to make the performance go down. I'm not really familiar with how code ignighter is constructed. But it seems that running as much as possible code from a function and only call the function on global scope helps a lot.

Mark Smit
  • 582
  • 4
  • 12
  • Hi Mark, yes i disabled error logging in /etc/hhvm/php.ini and it made no difference. Also the first request (ran 20 times) was with default HHVM settings so had warmup time (which i believe is 12 times as standard). :-( – Kirk Jul 03 '15 at 08:39