2014-10-04 5 views
1

나는 컴파일 시간이 더 긴 PHP 스크립트를 어떻게 쓸 수 있습니까??PHP에서 더 긴 컴파일 시간을 얻는 방법

OPCache 확장 기능에서 테스트으로 작업하고 싶습니다.

나중에 편집 : PHP 스크립트가로드되면 코드가 바이트 코드로 컴파일되고이 바이트 코드가 CPU에 의해 해석됩니다. 컴파일 과정은 일반적으로 몇 밀리 초가 걸리지 만 PHP 5.5에서 OPCache 확장을 테스트하려면이 시간을 매우 길게 만들어야합니다. 이 확장은 스크립트를 다시 컴파일 할 필요가 없도록 스크립트 바이트 코드를 캐시해야합니다.

+0

실행 시간을 의미합니까 아니면 아카이브를 만들기 위해 PHP 스크립트를 컴파일합니까? –

+1

나는 나의 질문을 분명히 할 것이다. – tzortzik

+1

github를 사용하여 큰 PHP 프로젝트를 찾으십시오. – exussum

답변

1

@PaulCrovella가 의견에서 지적한대로 ApacheBench가 필요했습니다. 코드의 약 600.000 라인 스크립트에서 명령 ab http://localhost/index.php을 사용하여

의 결과는 : 두 번째 벤치 마크 테스트에

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 

:

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 
최초의 벤치 마크 테스트에