“听说过没见过,两万五千里啊。。。”就像歌里唱的那样,对于框架的执行效率
我也是听别人说哪个框架执行效率有多高,从来没有亲自测试一下效率。这不,刚好有空
我也亲自测试一下,毕竟眼见为实啊。zend framework就不比了,执行效率最低不用说。
一、系统环境:
笔记本,内存1G,迅驰1.6G,windows xp sp2,Lighttpd 1.4.11 for windows,
PHP5.2.9-2,php以fast-cgi方式运行。(注:有对这环境配置感兴趣及遇到问题的请直接与我联系)
二、测试方式:利用框架渲染一个纯html页面,无数据库调用。
注:没有比较HelloWorld,一直觉得比较纯输出没有必要,比较脱离实际。
三、测试结果:
纯HTML:
并发:10
请求:100
Requests per second: 624.10 [#/sec] (mean)
Time per request: 16.023 [ms] (mean)
Time per request: 1.602 [ms] (mean, across all concurrent requests)
Transfer rate: 3588.59 [Kbytes/sec] received
-----------------------------------------------------------------------------
纯PHP:
并发:10
请求:100
Requests per second: 356.63 [#/sec] (mean)
Time per request: 28.040 [ms] (mean)
Time per request: 2.804 [ms] (mean, across all concurrent requests)
Transfer rate: 2007.82 [Kbytes/sec] received
-----------------------------------------------------------------------------
ThinkPHP:
并发:10
请求:100
Requests per second: 26.35 [#/sec] (mean)
Time per request: 379.546 [ms] (mean)
Time per request: 37.955 [ms] (mean, across all concurrent requests)
Transfer rate: 160.19 [Kbytes/sec] received
-----------------------------------------------------------------------------
YII:
并发:10
请求:100
Requests per second: 27.74 [#/sec] (mean)
Time per request: 360.518 [ms] (mean)
Time per request: 36.052 [ms] (mean, across all concurrent requests)
Transfer rate: 158.11 [Kbytes/sec] received
-----------------------------------------------------------------------------
CodeIgniter:
并发:10
请求:100
Requests per second: 31.30 [#/sec] (mean)
Time per request: 319.459 [ms] (mean)
Time per request: 31.946 [ms] (mean, across all concurrent requests)
Transfer rate: 174.36 [Kbytes/sec] received
-----------------------------------------------------------------------------
QEE:
并发:10
请求:100
Requests per second: 40.10 [#/sec] (mean)
Time per request: 249.359 [ms] (mean)
Time per request: 24.936 [ms] (mean, across all concurrent requests)
Transfer rate: 232.60 [Kbytes/sec] received
Ruby On Rails with Lighttpd Proxy:
并发:10
请求:100
Requests per second: 64.42 [#/sec] (mean)
Time per request: 155.223 [ms] (mean)
Time per request: 15.522 [ms] (mean, across all concurrent requests)
Transfer rate: 380.10 [Kbytes/sec] received
结论,在页面渲染输出上面,YII没有吹的那么好,Qee框架还确实技高一筹啊。不禁对老廖暗伸大拇指!
选择框架就像选择朋友一样,总是和的来的在一起。PHP圈子也没必要争个公母出来,既然发明出来了,就要服务好热情支持他们的开发者们。
另外,还看了一下RubyOnRails with Lighttpd on Proxy下的运行效率,比PHP框架执行效率都高。