Ambush Commander wrote:I just managed to get APD installed, so I'd like to know...
What is your view on profiling? Do you do it often? How do you go about profiling an application? What is your preferred profiler for PHP?
I wrote an article on profiling in general a few years back...
Not to give my article a plug, but WTH
http://www.codeproject.com/cpp/profiler.asp
My rating appears to have taken a dive since I last looked
Anyways, IMHO, I outline a general idea as to what profiling is and where you can apply techniques to languages like PHP - which may not automatically apply optimizations. Although I imagine the Zend engine does much of what VC++ compiler does???
My opinion on profiling...in PHP...I follow the simple rule: Keep any loops tight as possible
I also:
1) Always use single quotes - no variable interpolation
2) Use non-regex functions when possible str_replace as opposed to ereg_replace, etc...
3) Optimize SQL queries
4) Don't use mail() in a loop
5) Keep whitespace to a minimum - without affecting readability of course or comments

I use an editor which automatically clips whitespace from EOL.
6) Ahhh...I can't think of anymore right now
What do I use for profiling? Well if memory serves me correctly...PHP's microtime() don't do a very good job...
http://ca3.php.net/manual/en/function.microtime.php
I've tried that code in the sample and everytime I ran it on loops using very high iterations I would always get such crazy results I basically gave up on the microtime being that accurate - so basically I Gave up on hardcore profiling
I imagine there are apps which hook into the actual PHP code and using native C code allow you to profile entire functions much more accurately than PHP's microtime...but again IMHO...
Hardcore profiling isn't really worth it anymore these days...
It served it's purpose back in the day when clock cycles were precious commodity...but these days...
If you writing an application large enough, with a massive user base, it's likely more cost effective to just perform basic optimizations and instead opt for upgrading hardware, etc...then it is to dig through code finding every little cranny which you can optimize.
So, I say...profiling and optimizing beyond what I suggest above is not needed, hardcore profiling is best left for those academic types who need something to research
Just my two cents
