I was reading some articles - Brazil - about PHP performance and some coders consider to use the following code to find bottlenecks. The reason of that is because a page can be fast processed but very slow loaded. This script will output the the time that the server took to process the page and with Yslow - Firefox plugin - you can check how long it took to load the page.

On the start of the page include the code:

list($usec, $sec) = explode(’ ‘, microtime());
$script_start = (float) $sec + (float) $usec;

On the end of the page include this code:

list($usec, $sec) = explode(’ ‘, microtime());
$script_end = (float) $sec + (float) $usec;
$elapsed_time = round($script_end - $script_start, 5);
echo $elapsed_time;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]


Leave a Comment

You must be logged in to post a comment.

blank