in reply to Re^3: Interpreting Benchmark 'cmpthese' and 'timethese'
in thread Interpreting Benchmark's "cmpthese" and "timethese"

Dear rhesa,
You could run the benchmark for, say, 2000 iterations instead of for 5 seconds.
How do you do that? Because in the example I always see that they use negative value for $count.
timethese($count, { 'Name1' => sub { ...code1... }, 'Name2' => sub { ...code2... }, });
What value should I pass for $count here?

---
neversaint and everlastingly indebted.......

Replies are listed 'Best First'.
Re^5: Interpreting Benchmark 'cmpthese' and 'timethese'
by holli (Abbot) on Aug 28, 2006 at 10:00 UTC
    print $count < 0 ? "seconds" : "iterations";


    holli, /regexed monk/
Re^5: Interpreting Benchmark 'cmpthese' and 'timethese'
by rhesa (Vicar) on Aug 28, 2006 at 10:13 UTC
    As holli put it so succinctly, make $count positive to ask for a number of iterations. That is, $count = 2000 would do the trick.