PHP 5.1 Performance

Sebastian Bergmann » 14 June 2005 » in PHP » 2 Comments

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
Defined tags for this entry: , ,

Trackback specific URI for this entry

2 Comments to "PHP 5.1 Performance"

Display comments as (Linear | Threaded)
  1. verbat
    14/06/2005 at 19:35 Permalink
    so php5 now has a direct threading vm ?
    really nice to hear

    Reply

  2. Jani Tarvainen
    05/11/2005 at 21:59 Permalink
    Interesting. Did some benchmarking myself a while ago (http://janit.iki.fi/wp-bench/). I wonder how PHP 5.1 will affect the execution performance of accelerated scripts...

    Reply

9 Trackbacks to "PHP 5.1 Performance"

  1. Things That ... Make You Go Hmm 15/06/2005 at 17:07
    Sebastian Bergmann has benchmarked performance for PHP 5.1 against PHP 5.0.4, 4.3.11 using the three execution models (CALL, GOTO and SWITCH) that the new virtual machine PHP offers: Initial results show that PHP 5.1's GOTO-based executor gives a 400% ...
  2. WebhostingTech 19/06/2005 at 18:22
    Nachdem Interessierte bereits in der Lage sind die Version 5.1 zu testen, welche weiterhin Beta ist, nutzen andere wie Sebastian Bergmann bereits die Chance und prüfen die Performance an Hand eines Benchmarks. Sehr nett, auch wenn sich bis zur Veröffe...
  3. PHP-Homepage.de - News 24/06/2005 at 12:02
    Nachdem in der ersten Betaversion von PHP 5.1 ein Showstopper (kritischer Bug) gefunden wurde, wurde heute eine zweite Beta freigegeben. Die Neuerungen sind die selben wie in Beta 1.Eine komplette Liste der Änderungen steht im NEWS-File.Downloads stehen a
  4. Another Web Programmers Blog 25/11/2005 at 09:14
    Das PHP Team hat heute die Version 5.1 der Scriptsprache PHP veröffentlicht. Zu den wichtigesten Änderungen/Neuerungen gehören die Datenbankabstraktionsschicht PHP Data Objects (PDO). die erstmals eine eintheitliche Schnittstelle auf die verschiedene
  5. /home/martin 25/11/2005 at 09:43
    Ab sofort ist auf PHP.net die neue Version 5.1 von PHP verfügbar und bringt - neben den üblichen Bugfixes - ein paar (interessante) Neuerungen mit.Das wohl interessanteste Feature der 5.1er Version ist die Aktualisierung der Zend Engine II (der Sprachkern
  6. PHP-Homepage.de - News 25/11/2005 at 09:59
    Heute wurde die neue Version PHP 5.1.0 freigegeben.Die wichtigsten Neuerungen sind: PDO (PHP Data Objects), womit PHP endlich eine Datenbankabstraktionsschicht bekommt, eine erneute Beschleunigung der Zend Engine 2 (mit den neuen Ausführungsmodellen &quot
  7. Lafriks 03/12/2005 at 07:50
    PÄ“dÄ“jÄ laikÄ daudzas atklÄtÄ pirmkoda programmatÅ«ras projektos Ä«paÅ¡i liela uzmanÄ«ba tiek pievÄ“rsta ÄtrdarbÄ«bas uzlaboÅ¡anai. TÄ piemÄ“ram Mozilla Firefox 1.5 strÄdÄ manÄmi ÄtrÄk par 1.0.x versijÄm. Kas Ä«paÅ¡i priecÄ“, tad PHP 5.1 vers
  8. Jochens Blog 25/01/2006 at 01:02
    Sebastian Bergmann hat in seinem Blog vor einer Weile einen Benchmark über die Performance von PHP 4.3.11, PHP 5.0.4 und der damaligen Entwicklerversion von PHP 5.1 veröffentlicht. Da PHP 5.1 mittlerweile schon in Version 5.1.2 vorliegt und es auch in
  9. Sebastian Bergmann 25/01/2006 at 08:42
    I updated my previous benchmark of PHP 5.1. This time around I built PHP with GCC 3.4.5, GCC 4.0.2, and GCC 4.1.0.The bottom line result seems to be that GCC 4 generates slightly slower code:GCC 3.4.5: 15.223 GCC 4.0.2: 17.896 GCC 4.1.0: 17.847When I ha

Add Comment


To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Submitted comments will be subject to moderation before being displayed.