[wp-hackers] Help debugging long load time in plugin

Derek Hogue derek at amphibian.info
Fri Jan 2 01:45:43 GMT 2009


Hey all,

I recently released an update to my plugin (GigPress - <http://gigpress.com 
 >), and it caused people on some hosts to be reduced to unacceptable  
load times on their WP installs (2-3 seconds in some cases).  I can't  
find the common thread as of yet, as it's been a few different hosts  
(Bluehost and MediaTemple among them), but it must be somewhat rare,  
as more people than not have experienced no such slowdowns, and I  
can't recreate the issue on Dreamhost.

The main thing that differentiates the new version (where these issues  
are occurring for some people) and the old version (where it did not)  
is that I've moved to using the shortcode API for GigPress' output -  
and I'm using the output buffer to capture the output and return or  
echo it, depending on whether it was called via the shortcode or  
called directly via a template tag.

I should note that GigPress uses its own DB tables, and thus generates  
more MySQL queries than most plugins.  There are a couple of issues  
related to this that I'd be grateful for any help with.

1) What's the best way to display the elapsed time of each function  
(or portion thereof) in my plugin when my debug mode is on?  This  
would obviously help in finding the slowdown culprit in these cases.

2) Is there any way I can prevent my plugins queries from being run  
all the time, even when it's not being called by a post/page?  As soon  
as GigPress is enabled, the queries for a default install jump way up,  
as though every function in the plug-in is being called on each page  
load.

Any ideas would be greatly appreciated ...

Thanks in advance, and happy new year,
Derek
--
http://amphibian.info





More information about the wp-hackers mailing list