简体   繁体   English

HHVM始终比PHP CLI慢

[英]HHVM consistently slower than PHP CLI

I'm using code from the computer language benchmarks game; 我正在使用计算机语言基准测试游戏中的代码; namely nbody.php . nbody.php

When running without HHVM the performance is as follows: 在没有HHVM的情况下运行时,性能如下:

$ time php -n n.php 
real    0m5.247s
user    0m5.235s
sys 0m0.008s

When running with HHVM in server mode and reloading the pages 30+ times the speed is: 在服务器模式下以HHVM运行并重新加载页面30倍以上时,速度为:

real    0m6.905s
user    0m0.001s
sys 0m0.000s

I'm running HHVM with: hhvm -m server -v Eval.JitWarmupRequests=3 n.php 我正在使用以下hhvm -m server -v Eval.JitWarmupRequests=3 n.php运行HHVM: hhvm -m server -v Eval.JitWarmupRequests=3 n.php

Am I missing some 'special' configuration for HHVM? 我是否缺少HHVM的某些“特殊”配置? Or, is it just slower with nbody? 或者,使用nbody会更慢吗? My PHP tests are with 5.5.3 without any kind of an opcode cache. 我的PHP测试使用5.5.3,没有任何类型的操作码缓存。

We don't JIT pseudomains (code not in a function or class) because $globals is way too crazy to deal with. 我们不使用JIT伪主体(代码不在函数或类中),因为$globals太疯狂了,无法处理。

Put all your code in a function main() then call it. 将所有代码放入function main()然后调用它。

Also, make sure you warm up the server a bunch (maybe 100 requests) so the translation cache is primed. 另外,请确保将服务器预热一堆(也许有100个请求),以便为翻译缓存做好准备。

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

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