简体   繁体   English

HHVM 在 CLI 中比 PHP 5.5.9 慢

[英]HHVM slower than PHP 5.5.9 in CLI

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.好的,所以我真的很想使用并相信 HHVM,但是在我执行的每次测试中,HHVM 都比 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... HHVM 和 PHP 在 CLI 中运行在同一台服务器上:系统是...

  • Ubuntu 14.04 Ubuntu 14.04
  • 4 SSDs in RAID 0 RAID 0 中有 4 个 SSD
  • 2x Hexcore Xeons 2 个 Hexcore 至强
  • 64GB Ram 64GB 内存
  • Codeigniter 3.0 (framework) Codeigniter 3.0(框架)
  • PHP 5.5.9 PHP 5.5.9
  • HHVM (Latest stable release as of 2/7/2015) HHVM(截至 2015 年 2 月 7 日的最新稳定版本)

This script run 20 times under each of the below commands with the following results:此脚本在以下每个命令下运行 20 次,结果如下:

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

Average execution time = 0.0021平均执行时间 = 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平均执行时间 = 0.0020

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

Average execution time = 0.0003平均执行时间 = 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.显然这是一个小脚本,我已经通过它运行了大得多的脚本,我看到的时间是 PHP = 5.2s HHVM = 6.4s,这看起来并不多,但是当你运行太多这些脚本时,一切都会增加向上。

So my question is.. What the hell am i doing wrong?所以我的问题是..我到底做错了什么? Why can i not set HHVM to run quicker than PHP.为什么我不能将 HHVM 设置为比 PHP 运行得更快。 (is it an incompatibly with CI3.0? even though the HHVM site says 100% compatible?) (它是否与 CI3.0 不兼容?即使 HHVM 站点说 100% 兼容?)

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.编辑:所以在搜索和搜索之后似乎没有人可以提供答案,我已经使用标准 PHP 在没有 CI3 框架的情况下进行了测试,结果几乎相同,我在不同的论坛上问了其他 3 个人进行测试,他们得到了完全相同的结果相同的结果。 I conclude that HHVM is a load of hype and in real world scenarios it just doesnt cut the mustard.我的结论是 HHVM 是一种炒作,在现实世界的场景中,它并没有减少芥末。 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.如果有人能证明我是错的,我很乐意听取您的意见,因为从理论上讲,HHVM 听起来很棒,我很想使用一些可以像它声称的那样优化代码执行的东西。

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.我遇到了 hhvm 性能不佳的情况,我从未将其与普通 php 进行比较,但在我的情况下,这是由于 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. codeignighter 也有可能导致问题。 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.但似乎从函数中运行尽可能多的代码并仅在全局范围内调用该函数有很大帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM