人氣點閱:6984 |
發表人 |
php-7.0-mod_php-apache2.4 vs. HHVM performance quick test 2017-03-12 13:41 |
/ / /
|
|
php-7.0-mod_php-apache2.4 vs. HHVM performance quick test
All Test Env is by default, no additional fine tune,
so don't take these test too serious.
Box: Virtual Box @ Intel Core-i7 4-Core
Linux OS: Ubuntu 16.04.02
Kernel: 4.4.0-64 X86_64 SMP
Apache 2.4: Apache/2.4.18, 2016-07-14T12:32:26
PHP: PHP 7.0.15-0ubuntu0.16.04.4, mod_php7
HHVM: HipHop VM 3.18.1 (rel)
Test (1): random & hash test
php7-mod_php faster, 16s(mod_php) vs 23s(hhvm)
代碼:
<?PHP
function prepare_random_source()
{
$rtn = '';
for ($i=1; $i<=256; $i++)
{
$rtn .= mt_rand( 0, 9 ).'';
}
return $rtn;
}
$loop = 131072 * 2;
$t1 = time();
while($loop-- > 0)
{
$s1 = prepare_random_source();
$s2 = sha1(md5($s1));
$s3 = crc32($s1.$s2.mt_rand( 0, 1048576 ).'-'.time());
if ($loop % 2)
{
$s4 = mt_rand(1, 255) xor mt_rand(1, 255);
}
}
$t2 = time();
echo $t2 - $t1."\n";
?>
________________
美術插畫設計案子報價系統 v0.1 Beta
爪哇禾雀
|
|
Type
繪圖畫廊 設計藝廊 攝影相簿 留言板 最愛收藏 分類標籤
暱稱: Type 註冊: 2002-11-30 發表: 11173 來自: vovo2000.com
V幣: 901761
|
|
|
Re: php-7.0-mod_php-apache2.4 vs. HHVM performance quick test 2017-03-12 14:14 |
/ / /
|
|
Test (2): String Search & Replace test
php7-mod_php(16 seconds) still faster than hhvm(21 seconds)
代碼:
<?PHP
$orig_str="En Taro Adun, Zeratul.";
$str = '';
for ($i=0; $i<=255; $i++)
{
$str .= ($i+1).' '.$orig_str."\n";
}
$loop = 131072 * 8;
$ccnt = 0;
$t1 = time();
while ($loop-- > 0)
{
$b = explode("\n", $str);
$this_str = $b[($loop % 255)];
if (strstr($this_str, '3') || strstr($this_str, '11') || strstr($this_str, '17'))
{
$t = intval(time());
$t = ($t / 127);
$t--;
$c = str_replace('Adun', $t*$t, $this_str);
$ccnt++;
}
}
$t2 = time();
echo $t2 - $t1;
?>
________________
美術插畫設計案子報價系統 v0.1 Beta
爪哇禾雀
|
|
Type
繪圖畫廊 設計藝廊 攝影相簿 留言板 最愛收藏 分類標籤
暱稱: Type 註冊: 2002-11-30 發表: 11173 來自: vovo2000.com
V幣: 901761
|
|
|
|
|
|
|
|
|