# PHP 5.3 the slowest PHP of all times ?!?

- Thread: https://externals.io/message/36706
- Original archive: https://news-web.php.net/php.internals/36706
- Started by Stefan Esser on 2008-03-31T09:37:30+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #36706 — Stefan Esser — 2008-03-31T09:37:30+00:00

URL: https://externals.io/message/36706#36706

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Good morning,

I just want to bring attention to the fact that while benchmarks show
that PHP 5.3 is faster than PHP 5.2 on linux systems on MacOS/X the
opposite is shown.

Actually just executing bench.php from the PHP distribution shows that
PHP 5.3 is about half the speed of PHP 5.2.5

How can that happen?

Greets,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfwsNoACgkQSuF5XhWr2ng9egCgosYoQWLoXp4gpGLJSAz79uY7
ktkAoJdZ9Iq8DiDtqyGnQNseelAm/fyb
=UEbw
-----END PGP SIGNATURE

---

## #36709 — Marcus Boerger — 2008-03-31T15:07:23+00:00

URL: https://externals.io/message/36706#36709 · In reply to: #36706

Hello Stefan,

  did we change from non ZTS to ZTS builds on MacOS? ZTS builds do a bunch
  of additional copying of tables.

marcus

Monday, March 31, 2008, 11:37:30 AM, you wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

> Good morning,

> I just want to bring attention to the fact that while benchmarks show
> that PHP 5.3 is faster than PHP 5.2 on linux systems on MacOS/X the
> opposite is shown.

> Actually just executing bench.php from the PHP distribution shows that
> PHP 5.3 is about half the speed of PHP 5.2.5

> How can that happen?

> Greets,
> Stefan
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

> iEYEARECAAYFAkfwsNoACgkQSuF5XhWr2ng9egCgosYoQWLoXp4gpGLJSAz79uY7
> ktkAoJdZ9Iq8DiDtqyGnQNseelAm/fyb
> =UEbw
> -----END PGP SIGNATURE-----




Best regards,
 Marcus

---

## #36713 — Stefan Esser — 2008-03-31T15:15:30+00:00

URL: https://externals.io/message/36706#36713 · In reply to: #36709

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Marcus,

>   did we change from non ZTS to ZTS builds on MacOS? ZTS builds do a bunch
>   of additional copying of tables.

Nope. Thread Safety is disabled.

I did my comparision with PHP 5.2.5 and PHP 5.3-Snapshot.
Both versions were compiled with a simple ./configure without any
additional parameter. bench.php was executed with the CLI SAPI.

Here are the tables for PHP 5.2.5

simple             0.328
simplecall         0.405
simpleucall        0.660
simpleudcall       0.767
mandel             0.993
mandel2            1.253
ackermann(7)       0.993
ary(50000)         0.050
ary2(50000)        0.048
ary3(2000)         0.498
fibo(30)           2.229
hash1(50000)       0.089
hash2(500)         0.091
heapsort(20000)    0.281
matrix(20)         0.237
nestedloop(12)     0.535
sieve(30)          0.222
strcat(200000)     0.040
- ------------------------
Total              9.719


And here for PHP 5.3

simple             0.535
simplecall         0.799
simpleucall        1.322
simpleudcall       1.320
mandel             1.691
mandel2            2.170
ackermann(7)       1.299
ary(50000)         0.101
ary2(50000)        0.094
ary3(2000)         0.986
fibo(30)           3.282
hash1(50000)       0.225
hash2(500)         0.195
heapsort(20000)    0.499
matrix(20)         0.458
nestedloop(12)     0.948
sieve(30)          0.469
strcat(200000)     0.077
- ------------------------
Total             16.469

regards,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfxABIACgkQSuF5XhWr2niu0QCbBhCZWBW8nPX5G48YxNgM6qr2
8CQAn0SeMMKFjV1Hy/uKT4NSCMU5Lj/9
=lZtJ
-----END PGP SIGNATURE

---

## #36718 — Alexey Zakhlestin — 2008-03-31T15:25:05+00:00

URL: https://externals.io/message/36706#36718 · In reply to: #36713

I use debug/zts builds. my results are here:

PHP-5.3

simple             0.519
simplecall         1.441
simpleucall        2.378
simpleudcall       2.400
mandel             1.953
mandel2            2.814
ackermann(7)       2.671
ary(50000)         0.165
ary2(50000)        0.151
ary3(2000)         1.097
fibo(30)           5.745
hash1(50000)       0.265
hash2(500)         0.257
heapsort(20000)    0.629
matrix(20)         0.537
nestedloop(12)     0.978
sieve(30)          0.629
strcat(200000)     0.113
------------------------
Total             24.743


PHP-5.2.5

simple             0.587
simplecall         1.464
simpleucall        2.681
simpleudcall       3.060
mandel             2.265
mandel2            2.896
ackermann(7)       3.421
ary(50000)         0.164
ary2(50000)        0.143
ary3(2000)         1.186
fibo(30)           9.752
hash1(50000)       0.281
hash2(500)         0.273
heapsort(20000)    0.722
matrix(20)         0.520
nestedloop(12)     1.020
sieve(30)          0.649
strcat(200000)     0.116
------------------------
Total             31.200

On Mon, Mar 31, 2008 at 7:15 PM, Stefan Esser
<stefan.esser@sektioneins.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
>  Hash: SHA1
>
>  Hi Marcus,
>
>
> > […]
>
>  Nope. Thread Safety is disabled.
>
>  I did my comparision with PHP 5.2.5 and PHP 5.3-Snapshot.
>  Both versions were compiled with a simple ./configure without any
>  additional parameter. bench.php was executed with the CLI SAPI.
>
>  Here are the tables for PHP 5.2.5
>
>  simple             0.328
>  simplecall         0.405
>  simpleucall        0.660
>  simpleudcall       0.767
>  mandel             0.993
>  mandel2            1.253
>  ackermann(7)       0.993
>  ary(50000)         0.050
>  ary2(50000)        0.048
>  ary3(2000)         0.498
>  fibo(30)           2.229
>  hash1(50000)       0.089
>  hash2(500)         0.091
>  heapsort(20000)    0.281
>  matrix(20)         0.237
>  nestedloop(12)     0.535
>  sieve(30)          0.222
>  strcat(200000)     0.040
>  - ------------------------
>  Total              9.719
>
>
>  And here for PHP 5.3
>
>  simple             0.535
>  simplecall         0.799
>  simpleucall        1.322
>  simpleudcall       1.320
>  mandel             1.691
>  mandel2            2.170
>  ackermann(7)       1.299
>  ary(50000)         0.101
>  ary2(50000)        0.094
>  ary3(2000)         0.986
>  fibo(30)           3.282
>  hash1(50000)       0.225
>  hash2(500)         0.195
>  heapsort(20000)    0.499
>  matrix(20)         0.458
>  nestedloop(12)     0.948
>  sieve(30)          0.469
>  strcat(200000)     0.077
>  - ------------------------
>  Total             16.469
>
>  regards,
>
> Stefan
>  -----BEGIN PGP SIGNATURE-----
>  Version: GnuPG v1.4.8 (Darwin)
>  Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
>  iEYEARECAAYFAkfxABIACgkQSuF5XhWr2niu0QCbBhCZWBW8nPX5G48YxNgM6qr2
>  8CQAn0SeMMKFjV1Hy/uKT4NSCMU5Lj/9
>  =lZtJ
>  -----END PGP SIGNATURE-----
>
>
>
>  --
>  
>  
>
>



-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #36726 — Benjamin Schulz — 2008-03-31T20:26:53+00:00

URL: https://externals.io/message/36706#36726 · In reply to: #36706

Hi,


> I just want to bring attention to the fact that while benchmarks show
> that PHP 5.3 is faster than PHP 5.2 on linux systems on MacOS/X the
> opposite is shown.
>
> Actually just executing bench.php from the PHP distribution shows that
> PHP 5.3 is about half the speed of PHP 5.2.5
>
> How can that happen?

This commit is responsible for the bad performance:
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.579.2.52.2.77.2.11&r2=1.579.2.52.2.77.2.12&diff_format=u

---

## #36727 — Gwynne Raskind — 2008-03-31T20:34:58+00:00

URL: https://externals.io/message/36706#36727 · In reply to: #36726

> Hi,
>
> 
> > […]
>
> This commit is responsible for the bad performance:
> http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.579.2.52.2.77.2.11&r2=1.579.2.52.2.77.2.12&diff_format=u


-gstabs versus -g should have no effect on production performance.

-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."

---

## #36732 — Benjamin Schulz — 2008-03-31T21:41:16+00:00

URL: https://externals.io/message/36706#36732 · In reply to: #36727

Hi
> > […]
>
>
> -gstabs versus -g should have no effect on production performance.

Ok, maybe i made a mistake, that's what i compared:

bench.php with cvs update -r PHP_5_3 -D "2008-03-09 14:26 GMT":
Total              6.883

cvs update -D "2008-03-09 14:28 GMT":
Total             13.961

cvs diff -D "2008-03-09 14:26 GMT" -D "2008-03-09 14:28 GMT"
? pear/scripts
cvs diff: Diffing .
Index: configure.in
===================================================================
RCS file: /repository/php-src/configure.in,v
retrieving revision 1.647
retrieving revision 1.648
diff -r1.647 -r1.648
1c1
< ## $Id: configure.in,v 1.647 2008/02/17 20:49:46 helly Exp $ -*-  
autoconf -*-
---
 > ## $Id: configure.in,v 1.648 2008/03/09 14:27:15 gwynne Exp $ -*-  
autoconf -*-
124a125,139
 > dnl Darwin 9 hack
 > dnl Because the default debugging format used by Apple's GCC on Mac  
OS 10.5
 > dnl causes errors in all current and past versions of Autoconf, we  
do a little
 > dnl messing with the CFLAGS here to trick it.
 > php_did_darwin9_cheat=0
 > case $host_alias in
 > *darwin9*)
 >   echo $CFLAGS | grep -E '(^-g)|([[:space:]]-g)' 2>/dev/null >/dev/ 
null
 >   if test "$?" -ne 0; then
 >     php_did_darwin9_cheat=1
 >     CFLAGS="$CFLAGS -gstabs"
 >   fi
 >   ;;
 > esac
 >
170c185,192
<   GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*\([[0-9]]\+ 
\)\.[[0-9]]\+\..*/\1/;1p'`
---
 >   case $host_alias in
 >   *darwin*)
 >     GCC_MAJOR_VERSION=`$CC -dumpversion | $SED -nE '1s/([[0-9]]+)\. 
[[0-9]]+\..*/\1/;1p'`
 >     ;;
 >   *)
 >     GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*\ 
([[0-9]]\+\)\.[[0-9]]\+\..*/\1/;1p'`
 >     ;;
 >   esac
717a740,743
 >   dnl Finish the Darwin hack
 >   if test "$php_did_darwin9_cheat" -eq 1; then
 >     CFLAGS=`echo "$CFLAGS" | $SED -e 's/-gstabs//g'`
 >   fi

---

## #36738 — Gwynne Raskind — 2008-03-31T23:28:36+00:00

URL: https://externals.io/message/36706#36738 · In reply to: #36732

> > […]
>
> Ok, maybe i made a mistake, that's what i compared:

Upon investigation I've discovered the problem to be this: When the  
Darwin hack takes effect, the overwrite of CFLAGS removes the default - 
O2, thus the slowdown. I'll commit a fix shortly, with apologies for  
the oversight.

-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
