From my 20+ years as a Professional Webmaster, there’s alot of things that can cause problems like that, but why would you look at it in Firebug instead of Firefox and other browsers instead? Send the URL to me in a PM and I’m quite positive I can zero in on your problem quickly and hope you have the experience / knowledge to correct the problem(s).
With 20 years+ as a professional webmaster no doubt you would have heard of the Firefox extension “Firebug”? It’s the leading website diagnostic tools for developers and has been so for 3-5 years.
A very simple technique is to sprinkle some echo lines through your code, displaying the elapsed execution time.
You can use PHP’s microtime call() to gauge this with a little more accuracy.
If you want to get more serious, there are libraries that assist with execution profiling, so that may be an alternative - but in your case, probably overkill at the moment.
I’ve enclosed a first stab at a simple function that you can call throughout your code to show elapsed time between various parts - should make it very easy to see where most time is being used. Apologies in advance for any syntax or other errors - but it should be enough for you to get the idea!
Although, I have to say, 1 second or so isn’t that slow!
I’d also check ping time to the web host - that may be a part of the delay.
function log_time_elapsed($msg = '')
{
static $microtime_start = null;
list($u, $s) = explode(' ', microtime());
if($microtime_start === null)
{
$microtime_start = $u;
return 0;
}
list($u, $s) = explode(' ', microtime());
$diff = $u - $microtime_start;
$microtime_start = $u;
if (! empty($msg))
echo "$msg: elapsed microsecs $diff <br>\
";
return $diff;
}
// example use:
log_time_elapsed(); // first call initializes
...
log_time_elapsed("before db access");
// do db access ...
// ...
log_time_elapsed("after db access");
Yes brianoz; I know all about Firebug and don’t use it because it doesn’t show everything I need to know about a website. Your suggestions and PHP code to the original poster are correct and done nicely.
Let us not forget that Hostmonster is a well-known overseller. Server performance tends to suffer with oversellers–all of them. You can’t promise “unlimited” resources to everyone for very little money. Search for “hostmonster slow” and you’ll find other similar complaints.
We have several domains with Hostmonster. We are based in Australia. During our night (USA daytime) our sites load very slowly and sometime not at all.
Lots of bad reviews of Hostmonster. There is a reason people recommend staying away from oversellers.