Performance problem in Windows between 5.1 & 5.2

php.internals

Mauro Nicolás Infantino

19 years ago
Hi all, I'm using PHP 5.1.6 & 5.2.1. Is there any known performance issue with PHP 5.2.1? With the same script, same php.ini, same extensions, same apache (of course), I'm getting a huge difference. For example, with a microtime difference between start & end I get: - PHP 5.1.6: 111ms avg. - PHP 5.2.1: 205ms avg. Also, If I compare the results from the xdebug profiling extension it gets worse (322ms vs. 22ms). I can send the zipfile (69k) containing the two cachegrind files if needed. The code is a little complicated because it uses our framework with an autoprepended file and using __autoload, but you'll see that the function calls are exactly the same. Thanks in advance. Mauro Nicolás Infantino Vera 568 - BA - Argentina :: 54 11 4857 6585 :: www.digbang.com

Andrew Hutchings

19 years ago
Mauro Infantino wrote:
> Hi all, > > I'm using PHP 5.1.6 & 5.2.1. > Is there any known performance issue with PHP 5.2.1? > With the same script, same php.ini, same extensions, same apache (of course), I'm getting a huge difference. > > For example, with a microtime difference between start & end I get: > > - PHP 5.1.6: 111ms avg. > - PHP 5.2.1: 205ms avg.
I brought this issue up before using Linux, but it was all in my imagination apparently :) Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.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.

Mauro Nicolás Infantino

19 years ago
> -----Original Message----- > From: Andrew Hutchings [mailto:andrew@linuxjedi.co.uk] > Subject: [PHP-DEV] Re: Performance problem in Windows between > 5.1 & 5.2 > > I brought this issue up before using Linux, but it was all in my > imagination apparently :) > > Regards > Andrew
Thanks for your response, Andrew. Just to clarify: Maybe there's no performance problem. I'm seeing this behavior without any logical explanation (both installations are exactly equal and the difference in execution time is too big not to be noticed). Of course, this could be related to my lack of knowledge, and that's why I'm asking here for hints. OTOH, maybe there's a special situation that causes this (specific extension, apache version, etc), and it could be documented and reported just to prevent this situation in the future. Thanks.

Andrew Hutchings

19 years ago
Mauro N. Infantino wrote:
> Thanks for your response, Andrew. > > Just to clarify: Maybe there's no performance problem. I'm seeing this > behavior without any logical explanation (both installations are exactly > equal and the difference in execution time is too big not to be noticed). Of > course, this could be related to my lack of knowledge, and that's why I'm > asking here for hints.
Try 5.2.0, I found it has no performance hit when compared to 5.1.6. Regards Andrew
-- Andrew Hutchings - Linux Jedi - http://www.linuxjedi.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.

Mauro Nicolás Infantino

19 years ago
> -----Original Message----- > From: Andrew Hutchings [mailto:andrew@linuxjedi.co.uk] > Sent: Wednesday, April 25, 2007 4:46 AM > Subject: Re: [PHP-DEV] Performance problem in Windows between > 5.1 & 5.2 > > Try 5.2.0, I found it has no performance hit when compared to 5.1.6. > > Regards > Andrew
Hi, Since I didn't get anwsers besides the ones from Andrew, I investigated a little more. First of all, under Windows, I've executed the bench.php script for every relevant PHP version [1]. Seems that the strcat issue with PHP5.2.1 Andrew brought up a few months ago will be resolved in PHP5.2.2. What I've noticed is that bench.php doesn't make any tests with OO operations. So I've started a new script that tries to cover as much scenarios as possible. So far, I've not found the performance problem that started this thread (I've only found smaller perfomance in PHP5.2.2rc1 when using foreach). With all the new PHP5 OOP frameworks this could be an issue. One funny thing is that actually, without executing anything, class definitions are taking more time in PHP5.2.x. The problem I'm facing is that I'm trying to benchmark this, but I'm not being able because I can not find the way to iterate this case enough times to get a significant number. eval()'d code could be an option, but I don't know if the class definition inside eval()'d code follows the same process. Is there a way to achieve this? Is it possible class definitions are taking more time (twice) than before? Thanks in advance, Mauro. [1] PHP5.1 PHP5.2.0 PHP5.2.1 PHP5.2.2rc1 simple 0.346 0.349 0.345 0.350 simplecall 0.671 0.685 0.660 0.660 simpleucall 1.009 0.905 0.895 0.918 simpleudcall 1.250 1.173 1.180 1.209 mandel 1.110 1.174 1.145 1.126 mandel2 1.323 1.303 1.376 1.375 ackermann(7) 1.836 1.467 1.325 1.488 ary(50000) 0.118 0.061 0.059 0.067 ary2(50000) 0.117 0.050 0.051 0.058 ary3(2000) 0.573 0.573 0.576 0.556 fibo(30) 3.878 3.448 3.920 4.229 hash1(50000) 0.148 0.114 0.116 0.123 hash2(500) 0.110 0.099 0.103 0.120 heapsort(20000) 0.386 0.351 0.355 0.344 matrix(20) 0.312 0.297 0.279 0.286 nestedloop(12) 0.600 0.639 0.615 0.608 sieve(30) 0.553 0.293 0.271 0.304 strcat(200000) 0.437 0.053 0.341 0.053 ----------------------------------------------------------------- Total 14.778 13.034 13.612 13.874

Richard Lynch

19 years ago
On Wed, April 25, 2007 1:43 pm, Mauro N. Infantino wrote:
> definitions are taking more time in PHP5.2.x. The problem I'm facing > is that > I'm trying to benchmark this, but I'm not being able because I can not > find > the way to iterate this case enough times to get a significant number. > eval()'d code could be an option, but I don't know if the class > definition > inside eval()'d code follows the same process. Is there a way to > achieve > this? Is it possible class definitions are taking more time (twice) > than > before?
<?php $file = fopen('/tmp/foo', 'w'); //or whatever. for ($i = 0; $i < 1000000; $i++){ $class = <<<EOC class foo_$i { //more stuff here }; EOC; fwrite($file, $class); } fclose($file); //start timer require '/tmp/foo'; //end timer ?> "Crude, but effective Captain." -- Spock
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

Mauro Nicolás Infantino

19 years ago
> -----Original Message----- > From: Richard Lynch [mailto:ceo@l-i-e.com] > Subject: Re: [PHP-DEV] Performance problem in Windows between > 5.1 & 5.2 > > <?php > $file = fopen('/tmp/foo', 'w'); //or whatever. > for ($i = 0; $i < 1000000; $i++){ > $class = <<<EOC > class foo_$i { > //more stuff here > }; > EOC; > fwrite($file, $class); > } > fclose($file); > //start timer > require '/tmp/foo'; > //end timer > ?> > > "Crude, but effective Captain." -- Spock
Hehe.. Nice :) Not to be included in the bench script but just to verify if I was going on the right direction. Actually, I think I've found my problem (and maybe the problem of the people that answered off-list to me having the same problem). It only occurs on Windows and it's related with relative path inclusions. You will certainly notice it if you're using include_path and __autoload for your classes. I've filled a bug report. http://bugs.php.net/bug.php?id=41193 Thank you all for your help. Regards, Mauro.