in reply to Benchmark doesn't tell me what I want to hear
The first run of the first test will suck <DATA> dry. Every other run of that test and every run of the other tests will never call the function being benchmarked. Try:
my @data = <DATA>; my $result = timethese($count, { i_sep => sub { my %heap; foreach (@data) { i_sep( \%heap, $_) } }, i_peers => sub { my %heap; foreach (@data) { i_peers(\%heap, $_) } }, i_noop => sub { my %heap; foreach (@data) { i_noop( \%heap, $_) } }, });
It's good to check the result of tests by adding debug statememnts that will be removed when the tests are known to work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Benchmark doesn't tell me what I want to hear
by afresh1 (Hermit) on May 04, 2005 at 23:24 UTC |