快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

新蒲京澳门赌场网站:基于什么样的理由PHP比其它CGI好呢



Q:基于什么样的来由 PHP 比其它 CGI 好呢?有没有对照详细的数据可以证实 PHP 履行与其它 CGI 履行的效率好 ? 现在我的公司是用 C 来写 CGI 的,假如换成 PHP,会不会对照好呢 ?没有强而有力的依据的话,我就没法子说服上面的人让我转成 PHP 了...

A:

我觉得"好" 要有三点

第一: 写出来的程式的履行速率快.

第二: 碰到有大年夜量存取时的履行效能强.

第三: 程式开拓的光阴快,易掩护。

php在这三点中,虽都不必然是最好的,但也都在前茅

以下是C,PHP和Perl在速率方面的对照

我用下面的算式测试

$s=1.0;

for ($i=1;$i

然后用ab -n 10000 -c 20 http://mycgi

测试,结果

C说话用了 37.511 秒

PHP3用了 45.393 秒

PERL用了 68.418 秒

看起是C 最快没错,不过,和P新蒲京澳门赌场网站HP3的结果没有太大年夜

的差距。

Perl最慢

以下为测试数据

==============================================

C 说话

==============================================

Document Path: /~evan/test/gcc.cgi

Document Length: 19 bytes

Concurrency Level: 20

Time taken for tests: 37.511 seconds

Complete requests: 10000

Failed requests: 0

Total transferred: 1750000 bytes

HTML transferred: 190000 bytes

Requests per second: 266.59

Transfer rate: 46.65 kb/s received

Connnection Times (ms)

min avg max

Connect: 0 30 3001

Processing: 4 40 69

Total: 4 70 3070

PHP3

======================新蒲京澳门赌场网站========================

Document Path: /~evan/test/php3.php3

Document Length: 15 bytes新蒲京澳门赌场网站

Concurrency Level: 20

Time taken for t新蒲京澳门赌场网站ests: 45.393 seconds

Complete requests: 10000

Failed requests: 0

Total transferred: 1710000 bytes

HTML transferred: 150000 bytes

Requests per second: 220.30

Transfer rate: 37.67 kb/s received

Connnection Times (ms)

min avg max

Connect: 0 34 3039

Processing: 6 53 183

Total: 6 87 3222

PERL

==============================================

Document Path: /~evan/test/perl.cgi

Document Length: 17 bytes

Concurrency Level: 20

Time taken for tests: 68.418 seconds

Complete requests: 10000

Failed requests: 0

Total transferred: 1730173 bytes

HTML transferred: 170017 bytes

Requests per second: 146.16

Transfer rate: 25.29 kb/s receiv新蒲京澳门赌场网站ed

Connnection Times (ms)

min avg max

Connect: 0 22 3005

Processing: 9 112 323

Total: 9 134 3328

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: