1

より長いコンパイル時間を必要とする PHP スクリプトをどのように作成すればよいのでしょうか?

OPCache拡張機能でテストするためにこれを行いたいです。

後で編集: PHP スクリプトが読み込まれると、コードはバイトコードにコンパイルされ、このバイトコードは CPU によって解釈されます。通常、コンパイル プロセスには数ミリ秒かかりますが、PHP 5.5 の OPCache 拡張機能をテストするには、この時間を非常に長くする必要があります。この拡張機能は、スクリプトを再度コンパイルする必要がないように、スクリプトのバイトコードをキャッシュする必要があります。

4

1 に答える 1

1

@PaulCrovella がコメントで言ったように、私が必要としていたのは ApacheBench でした。

ab http://localhost/index.php約 600.000 行のコードを含むスクリプトでコマンドを使用すると、次の結果が得られました。

最初のベンチマーク テスト:

Server Software:        Apache/2.4.9
Server Hostname:        localhost
Server Port:            80

Document Path:          /index.php
Document Length:        4927 bytes

Concurrency Level:      1
Time taken for tests:   0.944 seconds
Complete requests:      1
Failed requests:        0
Total transferred:      5116 bytes
HTML transferred:       4927 bytes
Requests per second:    1.06 [#/sec] (mean)
Time per request:       944.054 [ms] (mean)
Time per request:       944.054 [ms] (mean, across all concurrent requests)
Transfer rate:          5.29 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   944  944   0.0    944     944
Waiting:      939  939   0.0    939     939
Total:        944  944   0.0    944     944

2 番目のベンチマーク テスト:

Server Software:        Apache/2.4.9
Server Hostname:        localhost
Server Port:            80

Document Path:          /index.php
Document Length:        4927 bytes

Concurrency Level:      1
Time taken for tests:   0.047 seconds
Complete requests:      1
Failed requests:        0
Total transferred:      5116 bytes
HTML transferred:       4927 bytes
Requests per second:    21.28 [#/sec] (mean)
Time per request:       47.003 [ms] (mean)
Time per request:       47.003 [ms] (mean, across all concurrent requests)
Transfer rate:          106.29 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    47   47   0.0     47      47
Waiting:       43   43   0.0     43      43
Total:         47   47   0.0     47      47
于 2014-10-04T19:40:39.737 に答える