Re: Benchmarking a script
| From: | Kim Steinhaug | Date: | Wed, 23 Jun 2004 16:07:34 +0000 |
| Subject: | Re: Benchmarking a script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188889@lists.php.net to get a copy of this message | ||
If you have an apache webserver setup you should look into the ab,
apache benchmark suite. This will give you a very good tool to
benchmark your files in its correct environment without altering your
code.
If youre on a windows plattform and cant locate the ab.exe tool
please tell me and I'll email it to you, I remember I spent some time
finding it.
--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------
"Anguz" <clavaque@prodigy.net.mx> wrote in message
news:20040623083701.70645.qmail@pb1.pair.com...
> 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