neversaint has asked for the wisdom of the Perl Monks concerning the following question:
Dear Masters,
I have the following benchmark snippets.
I have the following benchmark snippets.
Now I have difficulty in interpreting the result below:my $r = timethese( -5, { list => sub { code1($fstr); }, enum => sub { code2($fstr); } } ); cmpthese $r;
My questions are:Benchmark: running enum, list for at least 5 CPU seconds... enum: 5 wallclock secs ( 3.55 usr + 1.74 sys = 5.29 CPU) @ 50 +1.89/s (n=2655) list: 5 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU) @ 16 +68.23/s (n=8875) Rate enum list enum 502/s -- -70% list 1668/s 232% --
- from 'cmpthese' results it is clear that "list" is more than twice faster than "enum". But looking at the wallclock value from 'timethese' it shows that both of them are close to each other in their total time, even more the usertime for "enum" is shorter than "list". Now which is the correct benchmark should we use 'cmpthese' or 'timethese'? And which one is actually faster "enum" or "list"?
- What does "n" value refer to in 'timethese' output?
---
neversaint and everlastingly indebted.......
neversaint and everlastingly indebted.......
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Interpreting Benchmark 'cmpthese' and 'timethese'
by rhesa (Vicar) on Aug 28, 2006 at 09:21 UTC | |
by neversaint (Deacon) on Aug 28, 2006 at 09:27 UTC | |
by tye (Sage) on Aug 28, 2006 at 11:53 UTC | |
by rhesa (Vicar) on Aug 28, 2006 at 09:39 UTC | |
by neversaint (Deacon) on Aug 28, 2006 at 09:51 UTC | |
by holli (Abbot) on Aug 28, 2006 at 10:00 UTC | |
by rhesa (Vicar) on Aug 28, 2006 at 10:13 UTC |
Back to
Seekers of Perl Wisdom