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

So what is the best way to show the speed comparison in terms of it's time and not iteration/time?
I'm not sure what you mean by this. Would timethese with a positive value mean more to you? You could run the benchmark for, say, 2000 iterations instead of for 5 seconds. You'd probably see that "list" will run for about 7 seconds, while "enum" will take about 20 seconds.

Replies are listed 'Best First'.
Re^4: Interpreting Benchmark 'cmpthese' and 'timethese'
by neversaint (Deacon) on Aug 28, 2006 at 09:51 UTC
    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.......
      print $count < 0 ? "seconds" : "iterations";


      holli, /regexed monk/
      As holli put it so succinctly, make $count positive to ask for a number of iterations. That is, $count = 2000 would do the trick.