For Programmers: Free Programming Magazines  


Home > Archive > PHP on Windows > April 2005 > Re: [PHP-WIN] Optimize php code









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-WIN] Optimize php code
Graeme

2005-04-06, 12:43 pm

You need to find out where the code is spending its time. You can
quickly do that calling the microtome() function at various points in
your program and then calculating the time spent. Once you have located
the bottlenecks then you will need to think about your design, "Can this
be improved?" Obviously there is no universal panacea.

graeme.

martin hochreiter wrote:

> Hi there!
>
> I'm not the experienced php user, but I've been using
> php for a while and I've already written some bigger
> applications with it.
>
> These bigger applications are the 'problem', I know
> how to optimize database access but I have no idea
> how to optimize php code ... what makes php slow,
> what constructions, commands whatever I have to
> avoid.
>
> Can someone please give me a hint?
>
> lg
> martin
>


--
Experience is a good teacher, but she sends in terrific bills.

Minna Antrim
Martin Hochreiter

2005-04-06, 12:43 pm

Hi!

That was the only solution for my problem, I discovered myself.
Beside that I am searching for other hints ... I learned from
an article that some command - constructions are not processed
very quickly from the php interpreter (string conversions) and
some control structures are faster then other ones. Unfortunately
I can't remember what magazine it was.

lg

> You need to find out where the code is spending its time. You can
> quickly do that calling the microtome() function at various points in
> your program and then calculating the time spent. Once you have
> located the bottlenecks then you will need to think about your design,
> "Can this be improved?" Obviously there is no universal panacea.
>
> graeme.
>
> martin hochreiter wrote:
>

Jason Barnett

2005-04-06, 12:43 pm

The only way to really know is to test it yourself, with your machine
and your setup. Because what might be fast for me might be slow for
you. You should also have an overall goal in mind of how much time you
can spend on page loads.

If you need help testing scripts then you can go for apache bench, or
APD, or Zend, or ... (insert favorite profiler here)

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download....+search+plugins

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com