所用指令碼:
<?php$before = microtime(true
);$list= array
("keya" => "the value a"
,"keyb" => "the value b"
,"keyc" => "the value c"
,"keyd" => "the value c"
,"keye" => "the value c");
for ($i=0 ; $i
<100000 ; $i++)
$after = microtime(true
);echo ($after-$before)/$i . " sec/serialize\n";
1) 台式電腦 desktop01
os 名稱: microsoft windows 7 旗艦版
os 版本: 6.1.7601 service pack 1 build 7601
intel core i3 [email protected]
[01]: intel64 family 6 model 60 stepping 3 genuineintel ~3600
php 5.3.10 (cli) (built: feb 2 2012 20:27:51)
d:\proj\perf_test_php>php .\test.php1.7948508262634e-6 sec/serialize
d:\proj\perf_test_php>php .\test.php
2.0318198204041e-6 sec/serialize
d:\proj\perf_test_php>php .\test.php
2.0627999305725e-6 sec/serialize
2)精倫盒子 h1 (悲催的大了乙個數量級)
processor : armv7 processor rev 1 (v7l)
processor : 0
bogomips : 1196.03
features : swp half thumb fastmult vfp edsp thumbee vfpv3 vfpv3d16
cpu implementer : 0x41
cpu architecture: 7
cpu variant : 0x1
cpu part : 0xc09
cpu revision : 1
hardware : nxp bl-stb platform
root@routon-h1:/mnt/usb/perf_test_php# ./test.php3.1562120914459e-5 sec/serialize
root@routon-h1:/mnt/usb/perf_test_php# ./test.php
3.129940032959e-5 sec/serialize
root@routon-h1:/mnt/usb/perf_test_php# ./test.php
3.1241970062256e-5 sec/serialize
3)聯想g560 顯示卡雖然不行,cpu還是很給力的。
[01]: intel64 family 6 model 37 stepping 2 genuineintel ~2266 mhz
intel core i3 cpu [email protected]
php 5.3.10 (cli) (built: feb 2 2012 20:27:51)
win7:
c:\work\perf_test_php>php .\test.php3.260669708252e-6 sec/serialize
c:\work\perf_test_php>php .\test.php
3.2750701904297e-6 sec/serialize
c:\work\perf_test_php>php .\test.php
3.3444595336914e-6 sec/serialize
因為是雙系統,用kali linux 1.0a , php 5.4 再測了一下, 發覺linux下效能好很多(php5.4 也有關係?)
root@localhost:/media/h3usb/perf_test_php# php ./test.php1.9158411026001e-6 sec/serialize
root@localhost:/media/h3usb/perf_test_php# php ./test.php
1.947169303894e-6 sec/serialize
root@localhost:/media/h3usb/perf_test_php# php ./test.php
1.9439005851746e-6 sec/serialize
4)聯想上網本 s12, 比精倫盒子h1 還是要好一點的
intel atom n270 @1.6 ghz
[01]: x86 family 6 model 28 stepping 2 genuineintel ~1600 mhz
d:\perf_test_php>php test.php1.8191859722137e-5 sec/serialize
d:\perf_test_php>php test.php
1.8366029262543e-5 sec/serialize
d:\perf_test_php>php test.php
1.8153069019318e-5 sec/serialize
5)think pad t43 的表現很搶眼。 interl pentium 1.7ghz
windows xp, php 5.3 :
c:\work>php perf_test.php6.4734196662903e-6 sec/serialize
c:\work>php perf_test.php
6.4791107177734e-6 sec/serialize
c:\work>php perf_test.php
6.4785194396973e-6 sec/serialize
linux 上,差別不大。 linux kali-t43 3.18.0-kali3-686-pae
root@kali-t43:~# php ./perf-test.php6.5963220596313e-6 sec/serialize
root@kali-t43:~# php ./perf-test.php
6.4203810691833e-6 sec/serialize
root@kali-t43:~# php ./perf-test.php
6.4209914207458e-6 sec/serialize
集群中,各台機器之間打通SSH訪問的方法
假設我們需要打通clu01 a,clu01 b,clu01 c這三颱機器間的ssh訪問,步驟如下 1.在每台機器上,進入 ssh目錄,敲入下面的命令,會生成id rsa和id rsa.pub兩個檔案 ssh keygen t rsa ssh add 2.將每台機器上的 ssh id rsa.pub檔...
php 獲得linux 機器的效能
str shell exec more proc stat pattern cpu 0 9 s 0 9 s 0 9 s 0 9 s 0 9 s 0 9 s 0 9 s 0 9 preg match all pattern,str,out echo 共有 count out 1 個cpu,每個cpu利...
PHP檔案快取的效能測試
前言 在開發moophp的過程中,為了尋找更為高效的快取方式,對兩種最常用的快取方式進行了測試。php常用快取方式 第一種,把需要快取的資料進行處理,形成php可以直接執行的檔案。在需要快取資料的時候,通過include方式引入,並使用。第二種,把需要的資料通過serialize函式序列化後直接儲存...