PHP 5.2.1 twice as slow?

php.internals

Andrew Hutchings

19 years ago
Hi, I have been compiling 5.2.1 and comparing it with 5.2.0. The development box I am using is a Xeon 3.4 GHz with 4 cores (not sure if its 2xdual core or what, but not relevant here). I am compiling using -O2 -march=i686 -msse2. When running bench.php (http://cvs.php.net/viewvc.cgi/ZendEngine2/bench.php?view=markup) I found that 5.2.1 takes twice as long as 5.2.0: PHP 5.2.0 --------- simple 0.269 simplecall 0.472 simpleucall 0.829 simpleudcall 0.952 mandel 1.043 mandel2 1.203 ackermann(7) 0.859 ary(50000) 0.049 ary2(50000) 0.041 ary3(2000) 0.478 fibo(30) 2.093 hash1(50000) 0.088 hash2(500) 0.095 heapsort(20000) 0.279 matrix(20) 0.245 nestedloop(12) 0.458 sieve(30) 0.220 strcat(200000) 0.038 ------------------------ Total 9.713 PHP 5.2.1 --------- simple 0.537 simplecall 0.957 simpleucall 1.429 simpleudcall 1.467 mandel 1.988 mandel2 2.506 ackermann(7) 1.646 ary(50000) 0.087 ary2(50000) 0.073 ary3(2000) 0.983 fibo(30) 3.744 hash1(50000) 0.176 hash2(500) 0.194 heapsort(20000) 0.541 matrix(20) 0.446 nestedloop(12) 0.808 sieve(30) 0.422 strcat(200000) 0.422 ------------------------ Total 18.427 Please tell me I am missing something here :) Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Antony Dovgal

19 years ago
On 02/26/2007 01:06 AM, Andrew Hutchings wrote:
> Hi, > > I have been compiling 5.2.1 and comparing it with 5.2.0. The > development box I am using is a Xeon 3.4 GHz with 4 cores (not sure if > its 2xdual core or what, but not relevant here). I am compiling using > -O2 -march=i686 -msse2. > > When running bench.php > (http://cvs.php.net/viewvc.cgi/ZendEngine2/bench.php?view=markup) I > found that 5.2.1 takes twice as long as 5.2.0:
> Please tell me I am missing something here :)
I guess you were using different configure options, but I don't know, you didn't say anything about that.. Personally I can't see any difference between 5.2.0 (14.4 +- 0.1) and 5.2.1 (14.4 +- 0.1) on my laptop.
-- Wbr, Antony Dovgal

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> I guess you were using different configure options, but I don't know, > you didn't say anything about that.. > Personally I can't see any difference between 5.2.0 (14.4 +- 0.1) and > 5.2.1 (14.4 +- 0.1) on my laptop. >
Apologies, I'm using the same configure options for both builds. I'm using rpmbuild, same spec file for both builds (obviously modified in each case to use the correct source): --cache-file=../config.cache \ --with-libdir=%{_lib} \ --with-config-file-path=%{_sysconfdir} \ --with-config-file-scan-dir=%{_sysconfdir}/php.d \ --disable-debug \ --with-pic \ --disable-rpath \ --without-pear \ --with-bz2 \ --with-curl \ --with-exec-dir=%{_bindir} \ --with-freetype-dir=%{_prefix} \ --with-png-dir=%{_prefix} \ --enable-gd-native-ttf \ --without-gdbm \ --with-gettext \ --with-gmp \ --with-iconv \ --with-jpeg-dir=%{_prefix} \ --with-openssl \ --with-png \ --with-pspell \ --with-expat-dir=%{_prefix} \ --with-pcre-regex=%{_prefix} \ --with-zlib \ --with-layout=GNU \ --enable-exif \ --enable-ftp \ --enable-magic-quotes \ --enable-sockets \ --enable-sysvsem --enable-sysvshm --enable-sysvmsg \ --enable-track-vars \ --enable-trans-sid \ --enable-yp \ --enable-wddx \ --with-kerberos \ --enable-ucd-snmp-hack \ --with-unixODBC=shared,%{_prefix} \ --enable-memory-limit \ --enable-shmop \ --enable-calendar \ --enable-dbx \ --enable-dio \ --with-mime-magic=%{_sysconfdir}/httpd/conf/magic \ --without-sqlite \ --with-libxml-dir=%{_prefix} \ --with-xml \ Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Antony Dovgal

19 years ago
On 02/26/2007 01:58 AM, Andrew Hutchings wrote:
> Antony Dovgal wrote: >> I guess you were using different configure options, but I don't know, >> you didn't say anything about that.. >> Personally I can't see any difference between 5.2.0 (14.4 +- 0.1) and >> 5.2.1 (14.4 +- 0.1) on my laptop. >> > > Apologies, I'm using the same configure options for both builds. I'm > using rpmbuild, same spec file for both builds (obviously modified in > each case to use the correct source):
Please remove all these options and try with just ./configure --disable-all. Also please make sure the same CFLAGS are _really_ used in the build.
-- Wbr, Antony Dovgal

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> Please remove all these options and try with just ./configure > --disable-all.
Will do in the morning and report back. I will also try an un-optimised standard i386 build of each as see what happens. If it is any help (forgot to mention before) I am using gcc 4.1.0 and the box is running CentOS4.
> Also please make sure the same CFLAGS are _really_ used in the build.
Already have confirmed visually during compile and using analyse-x86 on the binary. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Antony Dovgal

19 years ago
On 02/26/2007 02:26 AM, Andrew Hutchings wrote:
> Antony Dovgal wrote: >> Please remove all these options and try with just ./configure >> --disable-all. > > Will do in the morning and report back. I will also try an un-optimised > standard i386 build of each as see what happens.
Thanks in advance. Btw, I would appreciate if you also try 5.2.2-dev snapshot, just to see if it makes any difference.
> If it is any help (forgot to mention before) I am using gcc 4.1.0 and > the box is running CentOS4.
I believe updating GCC to the latest version (4.1.2) might also help, GCC 4.1.x is known to be extremely picky in some cases.
>> Also please make sure the same CFLAGS are _really_ used in the build. > > Already have confirmed visually during compile and using analyse-x86 on > the binary.
Ok.
-- Wbr, Antony Dovgal

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> Thanks in advance. > Btw, I would appreciate if you also try 5.2.2-dev snapshot, just to see > if it makes any difference.
Up very late with my youngest son being sick so just compiled the snapshot made about 40 minutes ago with the same options, here are the results: simple 0.330 simplecall 0.506 simpleucall 0.805 simpleudcall 0.921 mandel 1.091 mandel2 1.459 ackermann(7) 1.028 ary(50000) 0.057 ary2(50000) 0.048 ary3(2000) 0.642 fibo(30) 2.479 hash1(50000) 0.107 hash2(500) 0.127 heapsort(20000) 0.358 matrix(20) 0.294 nestedloop(12) 0.605 sieve(30) 0.275 strcat(200000) 0.162 ------------------------ Total 11.293 Much better than the score I was getting for 5.2.1 although some of the tests are slightly slower than 5.2.0. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Antony Dovgal

19 years ago
On 02/26/2007 05:12 AM, Andrew Hutchings wrote:
> Antony Dovgal wrote: >> Thanks in advance. >> Btw, I would appreciate if you also try 5.2.2-dev snapshot, just to see >> if it makes any difference. > > Up very late with my youngest son being sick so just compiled the > snapshot made about 40 minutes ago with the same options, here are the > results:
<skip>
> Much better than the score I was getting for 5.2.1 although some of the > tests are slightly slower than 5.2.0.
I'm sure if won't see any difference if you run the bench a dozen of times, the results depend on current system status.
-- Wbr, Antony Dovgal

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> On 02/26/2007 05:12 AM, Andrew Hutchings wrote: >> Much better than the score I was getting for 5.2.1 although some of the >> tests are slightly slower than 5.2.0. > > I'm sure if won't see any difference if you run the bench a dozen of > times, the results depend on current system status. >
I ran bench several in each case and every time got the same to within a +/- 0.1 deviation. The server is my client's development server for me to work on, no one else uses it so the load is pretty much a constant 0 anyway. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> I'm sure if won't see any difference if you run the bench a dozen of > times, the results depend on current system status. >
I've just compiled both 5.2.0 and 5.2.1 on my low powered trash box (a 1GHz ViA EPIA) using: ./configure --disable-all --disable-cgi No CFLAGS were set and the box runs Ubuntu Edgy. My aim was a totally different environment to test with. GCC is version 4.1.2 (OS Default). php-5.2.0/sapi/cli/php bench.php simple 2.622 simplecall 2.935 simpleucall 4.277 simpleudcall 6.107 mandel 7.914 mandel2 9.700 ackermann(7) 6.233 ary(50000) 0.412 ary2(50000) 0.331 ary3(2000) 5.757 fibo(30) 13.147 hash1(50000) 0.641 hash2(500) 0.662 heapsort(20000) 2.153 matrix(20) 1.922 nestedloop(12) 4.542 sieve(30) 2.295 strcat(200000) 0.288 ------------------------ Total 71.940 php-5.2.1/sapi/cli/php bench.php simple 2.705 simplecall 3.045 simpleucall 4.483 simpleudcall 5.382 mandel 8.263 mandel2 10.415 ackermann(7) 6.453 ary(50000) 0.439 ary2(50000) 0.360 ary3(2000) 5.780 fibo(30) 14.413 hash1(50000) 0.685 hash2(500) 0.699 heapsort(20000) 2.221 matrix(20) 1.970 nestedloop(12) 4.678 sieve(30) 2.343 strcat(200000) 1.597 ------------------------ Total 75.932 These results vary by +/- 1 second on this box, the thing I find most interesting is the strcat test is slow in this as well. I am guessing the actually processing time is a lot slower on this box hence why my tests show a minimal difference in time in this case. My guess is it is something to do with the memory handler but I have no time left to gather any more evidence or delve into the source. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.

Stanislav Malyshev

19 years ago
>> I'm sure if won't see any difference if you run the bench a dozen of >> times, the results depend on current system status.
I tried to run test on my machine, could not reproduce the effect.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Andrew Hutchings

19 years ago
Antony Dovgal wrote:
> I believe updating GCC to the latest version (4.1.2) might also help, > GCC 4.1.x is known to be extremely picky in some cases.
I didn't feel like overhauling GCC just this minute so instead I used GCC 3.4.6 that is also in this box with just the -O2 and -march=i386 flags and and got the following results (I meant to compile 5.2.0 instead of 5.1.6 but they always give similar results for me anyway): PHP 5.1.6 --------- simple 0.271 simplecall 0.456 simpleucall 0.726 simpleudcall 0.784 mandel 0.943 mandel2 1.191 ackermann(7) 0.784 ary(50000) 0.056 ary2(50000) 0.049 ary3(2000) 0.461 fibo(30) 1.856 hash1(50000) 0.091 hash2(500) 0.095 heapsort(20000) 0.282 matrix(20) 0.255 nestedloop(12) 0.404 sieve(30) 0.244 strcat(200000) 0.053 ------------------------ Total 9.002 PHP 5.2.1 --------- simple 0.507 simplecall 0.945 simpleucall 1.493 simpleudcall 1.687 mandel 2.178 mandel2 2.950 ackermann(7) 1.939 ary(50000) 0.110 ary2(50000) 0.087 ary3(2000) 1.140 fibo(30) 4.265 hash1(50000) 0.220 hash2(500) 0.225 heapsort(20000) 0.591 matrix(20) 0.430 nestedloop(12) 0.786 sieve(30) 0.417 strcat(200000) 0.424 ------------------------ Total 20.395 The fact that the strcat test is so much slower may help diagnose where the delay is coming from, I am guessing at memory allocation. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.co.uk/ A-Wing Internet Services - http://www.a-wing.co.uk/ Windows is the path to the darkside...Windows leads to Blue Screen. Blue Screen leads to downtime. Downtime leads to suffering...I sense much Windows in you.