making bbPress (and WordPress) work better!

measuring WordPress performance

At some point you might get curious about how fast or slow WordPress is actually running, especially after a few strange reports that 2.0.4 is running slower.

I had tinkered with Jerome’s Query Diagnostics plugin: (at the bottom of the page)

but on the WordPress IRC I just learned about
libertus’ interesting “performance probe” plugin
which looks even more fascinating… (also see his other posts here and here)

added: apparently I can’t use his plugin (as many people on shared servers will discover) since my PHP was not compiled with the “–enable-memory-limit configuration option” – there is also a php function called “memory-get-peak-usage” which might be helpful to some.

Be sure to see all the links on the right hand side on my main page here for more performance and development plugins/info on WordPress.

By the way I made a subtle enhancement to Jerome’s output, the code follows below the break:

This mod will not only point out the longest query for you, it will separate the query time vs. the rest of the php generation time for that page – remember you need to do a “view source” on the webpage as the diagnostic is hidden in the comments.

function jquerydiag_output() {
global $wpdb;

while($qposition < $wpdb->num_queries){
if ($qsubtime>$qmaxtime) {$qmaxtime=$qsubtime;$qmaxquery=$wpdb->queries[$qposition][0];}
$qtotal += $qsubtime;
echo "<!-- \nquery count: ".$wpdb->num_queries." \n\n";
echo "total query time: ".round($qtotal,4)." seconds \n\n";
echo "total page time: ".round($timer_stop,4)." seconds.\n\n";
echo "page render difference: ".(round($timer_stop-$qtotal,4))." seconds \n\n";
echo "slowest call was: ".$qmaxquery."\n at ".round($qmaxtime,4)." seconds \n\n";
echo "-->";

2 responses

  1. Pingback: Basic Thinking Blog » Wordpress Performance

  2. good job friend
    keet it up!

    November 25, 2007 at 12:05 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s