PHP 5.1 Performance
Over the last couple of days I benchmarked the three execution models (CALL, GOTO, SWITCH) that the new virtual machine of PHP 5.1 offers against PHP 5.0.4 and PHP 4.3.11 (results with GCC 3.4.4, GCC 4.0.1).
Initial results show that PHP 5.1's GOTO-based executor gives a 400% better performance than PHP 4 and PHP 5.0. The benchmark script used is available here.
In PHP 5.1.0 the default executor will be CALL as it is the most tested one. You can use GOTO or SWITCH by using the --with-zend-vm={CALL|GOTO|SWITCH} configure parameter. GOTO and SWITCH currently segfault on the Ackermann benchmark, but this is being worked on.
Intel(R) Pentium(R) M Processor 1500MHz / 1024 KB Cache / 512 MB RAM
Linux 2.6.11-gentoo-r11
CFLAGS="-march=pentium-m -O2 -pipe"
./configure --disable-cgi --disable-all
GCC 3.4.4
HEAD (PHP 5.1.0-dev, June, 14th 2005)
CALL
simple 0.578
simplecall 0.638
simpleucall 0.918
simpleudcall 1.081
mandel 1.654
mandel2 2.003
ackermann(7) 1.008
ary(50000) 0.103
ary2(50000) 0.090
ary3(2000) 0.953
fibo(30) 5.220
hash(50000) 0.158
hash2(50) 0.363
heapsort(20000) 0.455
matrix(20) 0.405
nestedloop(12) 0.952
sieve(30) 0.491
strcat(200000) 0.090
------------------------
Total 17.159
GOTO
simple 0.298
simplecall 0.518
simpleucall 0.750
simpleudcall 0.926
mandel 1.201
mandel2 1.352
ackermann(7) segfault
ary(50000) 0.089
ary2(50000) 0.085
ary3(2000) 0.663
fibo(30) 4.627
hash(50000) 0.137
hash2(50) 0.326
heapsort(20000) 0.345
matrix(20) 0.298
nestedloop(12) 0.531
sieve(30) 0.388
strcat(200000) 0.070
------------------------
Total 12.605
SWITCH
simple 0.346
simplecall 0.514
simpleucall 0.763
simpleudcall 0.887
mandel 1.316
mandel2 1.502
ackermann(7) segfault
ary(50000) 0.090
ary2(50000) 0.086
ary3(2000) 0.672
fibo(30) 4.705
hash(50000) 0.140
hash2(50) 0.316
heapsort(20000) 0.366
matrix(20) 0.329
nestedloop(12) 0.615
sieve(30) 0.399
strcat(200000) 0.071
------------------------
Total 13.118
PHP 5.0.4
simple 1.779
simplecall 0.993
simpleucall 1.369
simpleudcall 1.531
mandel 6.445
mandel2 6.756
ackermann(7) 1.592
ary(50000) 0.182
ary2(50000) 0.152
ary3(2000) 2.502
fibo(30) 7.385
hash(50000) 0.226
hash2(50) 1.042
heapsort(20000) 1.158
matrix(20) 1.121
nestedloop(12) 2.683
sieve(30) 1.050
strcat(200000) 0.157
------------------------
Total 38.123
PHP 4.3.11
simple 1.880
simplecall 0.961
simpleucall 1.305
simpleudcall 1.498
mandel 6.879
mandel2 7.584
ackermann(7) 1.764
ary(50000) 0.183
ary2(50000) 0.155
ary3(2000) 2.501
fibo(30) 7.118
hash(50000) 0.236
hash2(50) 1.100
heapsort(20000) 1.240
matrix(20) 1.168
nestedloop(12) 2.577
sieve(30) 1.052
strcat(200000) 0.136
------------------------
Total 39.335
GCC 4.0.1-pre20050607
HEAD (PHP 5.1.0-dev, June, 14th 2005)
CALL
simple 0.585
simplecall 0.659
simpleucall 0.934
simpleudcall 1.082
mandel 1.544
mandel2 1.935
ackermann(7) 1.018
ary(50000) 0.101
ary2(50000) 0.089
ary3(2000) 0.883
fibo(30) 5.131
hash(50000) 0.158
hash2(50) 0.356
heapsort(20000) 0.442
matrix(20) 0.383
nestedloop(12) 0.961
sieve(30) 0.483
strcat(200000) 0.088
------------------------
Total 16.833
GOTO
simple 0.293
simplecall 0.503
simpleucall 0.741
simpleudcall 0.871
mandel 1.027
mandel2 1.297
ackermann(7) segfault
ary(50000) 0.087
ary2(50000) 0.084
ary3(2000) 0.645
fibo(30) 4.468
hash(50000) 0.137
hash2(50) 0.304
heapsort(20000) 0.334
matrix(20) 0.275
nestedloop(12) 0.519
sieve(30) 0.374
strcat(200000) 0.069
------------------------
Total 12.028
SWITCH
simple 0.426
simplecall 0.509
simpleucall 0.755
simpleudcall 0.882
mandel 1.274
mandel2 1.407
ackermann(7) segfault
ary(50000) 0.089
ary2(50000) 0.084
ary3(2000) 0.617
fibo(30) 4.592
hash(50000) 0.139
hash2(50) 0.304
heapsort(20000) 0.365
matrix(20) 0.293
nestedloop(12) 0.730
sieve(30) 0.387
strcat(200000) 0.071
------------------------
Total 12.922
PHP 5.0.4
simple 1.690
simplecall 1.043
simpleucall 1.413
simpleudcall 1.557
mandel 6.496
mandel2 6.676
ackermann(7) 1.652
ary(50000) 0.185
ary2(50000) 0.156
ary3(2000) 2.500
fibo(30) 7.547
hash(50000) 0.231
hash2(50) 1.046
heapsort(20000) 1.199
matrix(20) 1.131
nestedloop(12) 2.671
sieve(30) 1.064
strcat(200000) 0.157
------------------------
Total 38.414
PHP 4.3.11
simple 1.826
simplecall 0.922
simpleucall 1.285
simpleudcall 1.441
mandel 7.020
mandel2 7.569
ackermann(7) 1.791
ary(50000) 0.184
ary2(50000) 0.154
ary3(2000) 2.500
fibo(30) 7.489
hash(50000) 0.239
hash2(50) 1.163
heapsort(20000) 1.260
matrix(20) 1.193
nestedloop(12) 2.535
sieve(30) 1.045
strcat(200000) 0.142
------------------------
Total 39.756
sb@wopr-mobile ~ % ll benchmark/gcc-3.4.4
total 6928
-rwxr-xr-x 1 sb users 926528 Jun 14 16:52 php-4.3.11
-rwxr-xr-x 1 sb users 1244992 Jun 14 16:52 php-5.0.4
-rwxr-xr-x 1 sb users 1630112 Jun 14 16:52 php-5.1-CALL
-rwxr-xr-x 1 sb users 1623168 Jun 14 16:52 php-5.1-GOTO
-rwxr-xr-x 1 sb users 1642272 Jun 14 16:52 php-5.1-SWITCH
sb@wopr-mobile ~ % ll benchmark/gcc-4.0.1
total 6888
-rwxr-xr-x 1 sb users 930372 Jun 14 16:53 php-4.3.11
-rwxr-xr-x 1 sb users 1232120 Jun 14 16:53 php-5.0.4
-rwxr-xr-x 1 sb users 1622580 Jun 14 16:53 php-5.1-CALL
-rwxr-xr-x 1 sb users 1614516 Jun 14 16:53 php-5.1-GOTO
-rwxr-xr-x 1 sb users 1619508 Jun 14 16:53 php-5.1-SWITCH
14/06/2005 at 19:35 Permalink
really nice to hear
Reply
05/11/2005 at 21:59 Permalink
Reply