[wp-hackers] Re: WP Tuner plugin alpha - useful? suggestions...
Webbed.Pete at gmail.com
Webbed.Pete at gmail.com
Fri Jul 11 17:56:55 GMT 2008
On 10 Jul 2008 Jacob Santos said...
>I'm not sure I've seen code that was object oriented and procedural with
>majority of usage with globals. Did you choose that because of the
>performance of using globals vs properties?
Partially performance, and partially just being lazy -- I wrote some of this code a VERY
long time ago, before PHP had classes ;)... I will clean up the code a bit more at some
The timer globals are (or more accurately: once were) tuned carefully for performance
and repeatability. There are some additional features I've not yet ported into this. I might
never do it, because as you say, XDebug (and your plugin) provide much more
comprehensive timing analysis for developers.
Mind if I make reference to your plugin, for developers looking for more timing detail?
>Using microtime()...not the best method to tell the
>performance. It might tell you trouble spots of where to
>look, but it is using a broad brush when you should be
>using a finer one.
It seems to depend on the platform. I've had repeatability to a few microseconds, which
is plenty good enough for almost anything... and repeatability to a few milliseconds,
which is only good for major issues.
Note that I use microtime() for clock time, and get_rusage() for cpu. The hard part is that
my primary focus is on MySQL... and there's no guarantee that MySQL is running in the
same CPU let alone the same process space. So, I only look at clock time when
examining SQL query performance.
>It is slightly funny, I made a similar plugin:
>http://wordpress.org/extend/plugins/performance-testing/ with a similar
>goal. Great minds must think alike eh? Or at least need breeds
>invention, so on and so on.
Ah! I just found that one a couple of days ago. Yes, necessity breeds invention. I'm sure
you wrote yours because you needed it... and I suspect you are quite familiar with
Different goals. Yours appears to do a great job of capturing (XDebug-based) code
tracing. That's a level that mine would never accomplish without serious pain.
>Some of your code did give a few ideas.
Good! I'm always glad to share.
>One suggestion is to use the XDebug xdebug_time_index( ) to get the
>time. It might give a better indicator.
I'm not sure if I want mine to require XDebug. Maybe as an option, if there, for dev's...
> What I do like about your plugin is that you don't require any extra PHP
> extensions that are non-standard on most PHP installations, like mine does.
Yours is clearly 100% aimed at dev's -- as it should be.
Mine is 100% aimed at the average site admin. If dev's find it helpful, that's good too.
For me, avoiding complex install is crucial. That's why I went to so much trouble to make
it fully self-configuring/self-patching. Any dev can easily plug a couple of lines of code
into wp-config... but I imagine many admins would be nervous about that.
Thanks for the feedback and encouragement, Jacob!
More information about the wp-hackers