Jano Svitok
1/13/2007 10:00:00 AM
On 1/13/07, chen li <chen_li3@yahoo.com> wrote:
> Hi all,
>
> I know I can use this format to check the performance
> of my sctipt:
>
> result= Benchmark.measure{##script included here##}
>
> But this code will look ugly if the script spans many
> lines.I wonder 1) if there is a better means and 2)
> what if I want to check the same script for 10000
> times.
Hi,
1. you can put the script in a method/function and call that.
2. use 10000.times { } ;-)
either result = Benchmark.measure { 10000.times { script }}
or result = 1..10000.map { Benchmark.measure { script }}