PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Odd performance problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Odd performance problem

Réponse
 
LinkBack Outils de la discussion
Vieux 07/05/2008, 16h31   #1
Joeri Sebrechts
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Odd performance problem

Hello,

While debugging a script that ran too slowly I came across something that I
can't explain.

It is inactive code that when removed doubles the run time of the script.

Specifically, the issue is a switch statement, where one of the cases is
never reached. If I remove the case from the code, the run time of the
script goes from 6 seconds to 12 seconds.

To see this problem in action, you can download the problematic script here:
http://sebrechts.net/files/2008/phpperfissue.zip

Anyone have any ideas on how this is even possible? I'd like to improve the
run time of the script, but if every part of code that I take out makes it
run longer ...

Thanks


  Réponse avec citation
Vieux 09/05/2008, 08h43   #2
Robert Cummings
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Odd performance problem


On Wed, 2008-05-07 at 17:31 +0200, Joeri Sebrechts wrote:
> Hello,
>
> While debugging a script that ran too slowly I came across something that I
> can't explain.
>
> It is inactive code that when removed doubles the run time of the script.
>
> Specifically, the issue is a switch statement, where one of the cases is
> never reached. If I remove the case from the code, the run time of the
> script goes from 6 seconds to 12 seconds.
>
> To see this problem in action, you can download the problematic script here:
> http://sebrechts.net/files/2008/phpperfissue.zip
>
> Anyone have any ideas on how this is even possible? I'd like to improve the
> run time of the script, but if every part of code that I take out makes it
> run longer ...


Runs the same for me either way... under PHP4 and PHP5. You must have a
nice system, takes 22 seconds both ways on my Athlon 2400

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

  Réponse avec citation
Vieux 09/05/2008, 12h42   #3
Thiago Pojda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RES: [PHP] Odd performance problem

My tests on PHP 4.4.8

Default files:

Run 1)
done at 100045

Time: 12.5804 Seconds

Run 2)
done at 100045

Time: 12.6775 Seconds

Run 3)
done at 100045

Time: 13.0696 Seconds

Now editing the file, removed the switch case 'a' part.

Run 1)
done at 100045

Time: 12.6981 Seconds

Run 2)
done at 100045

Time: 12.8659 Seconds

Run 3)
done at 100045

Time: 12.7886 Seconds

As you can see, there's no really big difference here. It really does look
like it's slower, but .1 sec slower.


Hey Robert, this was just a semprom 3k... didn't know they were that dif



Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda@softpartech.com.br
Excelência em Softwares Financeiros

-----Mensagem original-----
De: Robert Cummings [mailto:robert@interjinn.com]
Enviada em: sexta-feira, 9 de maio de 2008 04:44
Para: Joeri Sebrechts
Cc: php-general@lists.php.net
Assunto: Re: [php] Odd performance problem

On Wed, 2008-05-07 at 17:31 +0200, Joeri Sebrechts wrote:
> Hello,
>
> While debugging a script that ran too slowly I came across something that

I
> can't explain.
>
> It is inactive code that when removed doubles the run time of the script.
>
> Specifically, the issue is a switch statement, where one of the cases is
> never reached. If I remove the case from the code, the run time of the
> script goes from 6 seconds to 12 seconds.
>
> To see this problem in action, you can download the problematic script

here:
> http://sebrechts.net/files/2008/phpperfissue.zip
>
> Anyone have any ideas on how this is even possible? I'd like to improve

the
> run time of the script, but if every part of code that I take out makes it


> run longer ...


Runs the same for me either way... under PHP4 and PHP5. You must have a
nice system, takes 22 seconds both ways on my Athlon 2400

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  Réponse avec citation
Vieux 09/05/2008, 14h45   #4
Joeri Sebrechts
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Odd performance problem

Ha, I tried again today, and now there's no difference. I'm thinking now
that this was some sort of page boundary issue, or something of the sort. On
the one hand it's a relief I can move on, on the other hand it's frustrating
because I know for a fact that I saw those differences, and this problem
might be happening for some of our customers.

I'll just blame windows, that always works

By the way, a 22 second run-time is definitely abnormal. I only have a 3 ghz
P4, a 3 year old machine. When I disable xdebug it takes 4.5 seconds.
Another by the way, while measuring the performance of this script I noticed
that wincachegrind's time reports are incorrect. It reported a cumulative
run-time of about one second. Kcachegrind (the KDE4 for windows version) did
report correct times, so I'll be using that from now on.


""Thiago Pojda"" <thiago.pojda@softpartech.com.br> wrote in message
news:012501c8b1c9$bb172c20$0201a8c0@softpartech...
My tests on PHP 4.4.8

Default files:

Run 1)
done at 100045

Time: 12.5804 Seconds

Run 2)
done at 100045

Time: 12.6775 Seconds

Run 3)
done at 100045

Time: 13.0696 Seconds

Now editing the file, removed the switch case 'a' part.

Run 1)
done at 100045

Time: 12.6981 Seconds

Run 2)
done at 100045

Time: 12.8659 Seconds

Run 3)
done at 100045

Time: 12.7886 Seconds

As you can see, there's no really big difference here. It really does look
like it's slower, but .1 sec slower.


Hey Robert, this was just a semprom 3k... didn't know they were that dif



Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda@softpartech.com.br
Excelência em Softwares Financeiros

-----Mensagem original-----
De: Robert Cummings [mailto:robert@interjinn.com]
Enviada em: sexta-feira, 9 de maio de 2008 04:44
Para: Joeri Sebrechts
Cc: php-general@lists.php.net
Assunto: Re: [php] Odd performance problem

On Wed, 2008-05-07 at 17:31 +0200, Joeri Sebrechts wrote:
> Hello,
>
> While debugging a script that ran too slowly I came across something that

I
> can't explain.
>
> It is inactive code that when removed doubles the run time of the script.
>
> Specifically, the issue is a switch statement, where one of the cases is
> never reached. If I remove the case from the code, the run time of the
> script goes from 6 seconds to 12 seconds.
>
> To see this problem in action, you can download the problematic script

here:
> http://sebrechts.net/files/2008/phpperfissue.zip
>
> Anyone have any ideas on how this is even possible? I'd like to improve

the
> run time of the script, but if every part of code that I take out makes it


> run longer ...


Runs the same for me either way... under PHP4 and PHP5. You must have a
nice system, takes 22 seconds both ways on my Athlon 2400

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





  Réponse avec citation
Vieux 09/05/2008, 16h16   #5
Robert Cummings
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: RES: [PHP] Odd performance problem


On Fri, 2008-05-09 at 08:42 -0300, Thiago Pojda wrote:
>
> Runs the same for me either way... under PHP4 and PHP5. You must have
> a nice system, takes 22 seconds both ways on my Athlon 2400


Maybe it's because I use Evolution for my mail client and it has
steadily increased it's CPU suckage over the years. I have no idea what
it does but these days I noticed it's eating a steady 8-12% of my
CPU Unfortunately I didn't like Thunderbird last time I checked.
Maybe I'll give Opera's mail client a go since I use the Opera browser
anyways.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h25.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13406 seconds with 13 queries