At 6/21/2002, you wrote:
>PS> What about execution time in ms (with breakpoints)?
>PS> And is there way to measure MySQL query speed in ms?
>
>u can use microtime function
>
>     function getMicrotime()
>     {
>         list($usec, $sec) = explode(" ",microtime());
>         return ((float)$usec + (float)$sec);
>     }
>
>in your head of your script than call:
>
>$start = getMicrotime();
>
>and then in the end of script
>
>$stop = getMicrotime();
>$diff = $stop - $start;
>echo "Execution time was: ".$diff;

Thanks! That was really useful. I placed it around the biggest/most complex 
MySQL query on the code and found out that the biggest slow down there was 
due ORDER BY command (and not LIKE I thought was). So, I removed the ORDER 
BY and did array sorting using PHP (PHP did it in less than a millisecond) 
and got this query speed down from .25s to .07s

Optimising can be so much fun! ;)

Pekka
http://photography-on-the.net/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to