user1529891
user1529891

Reputation:

HHVM consistently slower than PHP CLI

I'm using code from the computer language benchmarks game; namely nbody.php.

When running without HHVM the performance is as follows:

$ 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:

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

I'm running HHVM with: hhvm -m server -v Eval.JitWarmupRequests=3 n.php

Am I missing some 'special' configuration for HHVM? Or, is it just slower with nbody? My PHP tests are with 5.5.3 without any kind of an opcode cache.

Upvotes: 2

Views: 1453

Answers (1)

Paul Tarjan
Paul Tarjan

Reputation: 50652

We don't JIT pseudomains (code not in a function or class) because $globals is way too crazy to deal with.

Put all your code in a function main() then call it.

Also, make sure you warm up the server a bunch (maybe 100 requests) so the translation cache is primed.

Upvotes: 6

Related Questions