Hello,

I have a script I am optimizing and want to compare the before and after in speed. So I wrote a few lines to loop this script but I have a problem. In the script I'm optimizing there's some function definitions and when the script starts the second iteration it throws an error because the function already exists. How can I modify my benchmark code to make it work? This is what I have:

<?php
$bench_n = 1000;
for($bench_i=$bench_n; --$bench_i>=0; ){
        ob_start();
        $bench_time1 = array_sum(explode(' ', microtime()));
        // script start ************************************

                // script...

// script end **************************************
$bench_time0 += array_sum(explode(' ', microtime())) - $bench_time1;
while(@ob_end_clean());
}
echo '<pre>Tot Time: ' , $bench_time0 , '<br />Loops: ' , $bench_n , '<br />Avg Time: ' , ($bench_time0 / $bench_n) , '</pre>';
?>


Thank you very much in advance.

Cristian

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



Reply via email to