Re: PHP performance profiling
| From: | Eric Butera | Date: | Tue, 18 Nov 2008 17:16:04 +0000 |
| Subject: | Re: PHP performance profiling | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283473@lists.php.net to get a copy of this message | ||
On Tue, Nov 18, 2008 at 10:11 AM, Gryffyn
<gryffyn@gryffyndevelopment.com> wrote:
> I did a search and didn't find anything really astounding sounding, so I
> wanted to ask for some "live" recommendations from the crowd here.
>
> I was wondering if anyone had used FirePHP with Firebug or could recommend a
> good profiling method for figuring out where the slow parts of your PHP
> code are.
>
> I'm curious about solutions that don't require installing something on the
> server side, since that's not usually an option with shared web hosting and
> all.
>
> I used to love Zend Studio's server component along with the IDE, but it
> doesn't help so much with shared web hosts where you can't install the
> server component.
>
> Ideally, I'd love to see what segments of the code are running slow, but at
> the very minimum, I want to see if it's the PHP code or the MySQL calls
> that are slow. I know I can just add my own statements in the code, but I
> was hoping there was a more comprehensive solution available.
>
> Thanks in advance.
>
> -TG
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If you cannot install stuff on your server, set yourself up a local
dev environment. You should really be doing this anyways. One of the
easiest ways to do this is to download a pre-made vmware player server
application. Or you could do the xampp thing.
Once you have that you can use xdebug [1] to profile your code. It
has a lot of various ways of profiling. It doesn't require you
modifying your code at all. Then it generates these files that you
can use kcachegrind/wincachegrind to see every single function your
script calls, how long it took, etc. There's also another tool to
view these files called webgrind[2]
[1] http://www.xdebug.org/docs/profiler
[2] http://code.google.com/p/webgrind/