I tried to do some php 5.5 vs HHVM tests and got pretty good results with hhvm. However, bubble sorting performance on HHVM is pretty poor. I assume this has something to do with arrays. In the example below, when q = 1000 hhvm, it is almost 5 times worse than php 5.5. Since in both cases, since the test has been done so many times, I do not think that warm-up time should be a problem. In both cases, they work in fastcgi mode. In the case where q = 1000 php5.5 took about 200 ms to serve the page against almost 1000 ms for hhvm. I tried using splfixedclass, but its performance on hhvm was good too. Is there a special class or some special options that will improve array performance in hhvm?
I explained exactly what I did here:
http://letschat.info/php-5-5-vs-hhvm-vs-node-js-benchmark-part-2/
$starttime = microtime(true);
if($_GET['q']!=""){
$count = $_GET['q'];
} else {
$count = 100;
}
function getRandom(){
$random = array();
global $count;
for($i=0;$i<$count;$i++){
$random[]=rand(1,100);
}
return $random;
}
$array = getRandom();
for($i=0;$i<10;$i++) {
$a = count($array);
$b=$a-1;
for($j=0; $j < $a; $j++){
for ($k=0;$k<$b;$k++) {
if ($array[$k+1] < $array[$k]) {
$t = $array[$k];
$array[$k] = $array[$k+1];
$array[$k+1] = $t;
}
}
}
$array[$count/2]=rand(1,100);
}
print_r($array);
echo microtime(true) - $starttime;
source
share