Skip to content
Hunter Wu edited this page Jan 16, 2019 · 1 revision
git clone https://github.com/andrewmriley/PHP-Speed-Tests.git
vim /var/www/date.php
<?php 
echo date('Y-m-d H:i:s');

Ubuntu 13.10 x86_64

  • PHP 5.5.3-1ubuntu2.2
  • Apache/2.4.6
  • nginx/1.4.1

cli

$ php variables.php
(int control) time: 1.1668109893799
(int string) time: 1.689964056015
(intval string) time: 2.401358127594
(int int) time: 1.617959022522
(intval int) time: 2.1769452095032
(int string int) time: 1.7490780353546
(intval string int) time: 2.4681680202484
(int real) time: 1.4755160808563
(intval real) time: 2.1999320983887
$ hhvm variables.php
(int control) time: 1.5424020290375
(int string) time: 1.8267579078674
(intval string) time: 1.7886610031128
(int int) time: 1.570032119751
(intval int) time: 1.603630065918
(int string int) time: 2.0462698936462
(intval string int) time: 1.8424439430237
(int real) time: 1.6115400791168
(intval real) time: 1.6298940181732

apache2

# ab -n 5000 -c 100 http://localhost/date.php

; with opcache
Time taken for tests:   0.608 seconds
Requests per second:    8224.85 [#/sec] (mean)

; with hhvm
Time taken for tests:   1.752 seconds
Requests per second:    2854.13 [#/sec] (mean)
# ab -n 5000 -c 100 http://localhost/codeigniter/index.php

; with opcache
Time taken for tests:   2.938 seconds
Requests per second:    1701.84 [#/sec] (mean)

; with hhvm
Time taken for tests:   4.086 seconds
Requests per second:    1223.76 [#/sec] (mean)

nginx

# ab -n 5000 -c 100 http://localhost:82/date.php

; with opcache
Time taken for tests:   0.726 seconds
Requests per second:    6884.06 [#/sec] (mean)

Ubuntu 13.10 i386

  • PHP 5.5.3-1ubuntu2.2
  • Apache/2.4.6

cli

$ php variables.php
(int control) time: 1.4791431427002
(int string) time: 2.2059090137482
(intval string) time: 2.9872889518738
(int int) time: 1.8500099182129
(intval int) time: 2.6770219802856
(int string int) time: 2.2576248645782
(intval string int) time: 3.0368509292603
(int real) time: 1.9482262134552
(intval real) time: 2.7326838970184

apache2

# ab -n 5000 -c 100 http://localhost/date.php

; with opcache
Time taken for tests:   0.553 seconds
Requests per second:    9044.34 [#/sec] (mean)

LinuxDeepin

  • PHP 5.4.9-4ubuntu2.4
  • Apache/2.2.22

cli

# php variables.php
(int control) time: 1.4676990509033
(int string) time: 2.0603880882263
(intval string) time: 2.8033990859985
(int int) time: 1.7817809581757
(intval int) time: 2.5697360038757
(int string int) time: 2.3859360218048
(intval string int) time: 2.8841707706451
(int real) time: 1.8401849269867
(intval real) time: 2.5940158367157

apache2

# ab -n 5000 -c 100 http://localhost/date.php

; without apc
Time taken for tests:   1.183 seconds
Requests per second:    4225.55 [#/sec] (mean)

; with apc
Time taken for tests:   0.835 seconds
Requests per second:    5991.58 [#/sec] (mean)
Clone this wiki locally