家里各台机器的php性能测试

时间:2022-07-08 21:17:57

所用脚本:

<?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++) {
serialize($list);
} $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 4160@3.60GHz

[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.php
1.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.php
3.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 M350@2.2Hz
PHP 5.3.10 (cli) (built: Feb 2 2012 20:27:51)

Win7:

C:\work\perf_test_php>php .\test.php
3.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.php
1.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.php
1.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.php
6.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.php
6.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