diff options
author | Barrie Slaymaker <barries@slaysys.com> | 1999-10-02 20:09:51 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-10-03 09:23:16 +0000 |
commit | 277427cf4e56f8c457d0805b2bd9ffb88d75e5a5 (patch) | |
tree | 7081acd18c266de30c3fa0d57cc201e1f133d7b9 /lib/Benchmark.pm | |
parent | ae178db11db50e8d46c66980e186cfba029f0cb9 (diff) | |
download | perl-277427cf4e56f8c457d0805b2bd9ffb88d75e5a5.tar.gz |
Benchmark.pm bugfix, tweaks
To: perl5-porters@perl.org
Message-Id: <199910030409.AAA18228@jester.slaysys.com>
p4raw-id: //depot/cfgperl@4292
Diffstat (limited to 'lib/Benchmark.pm')
-rw-r--r-- | lib/Benchmark.pm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm index 08caa48349..91966735df 100644 --- a/lib/Benchmark.pm +++ b/lib/Benchmark.pm @@ -198,14 +198,14 @@ Clear all cached times. =item cmpthese ( RESULTSHASHREF ) Optionally calls timethese(), then outputs comparison chart. This -chart is sorted from slowest to highest, and shows the percent +chart is sorted from slowest to fastest, and shows the percent speed difference between each pair of tests. Can also be passed the data structure that timethese() returns: $results = timethese( .... ); cmpthese( $results ); -Returns the data structure returned by timethese(). +Returns the data structure returned by timethese() (or passed in). =item countit(TIME, CODE) @@ -444,9 +444,7 @@ sub runloop { # in &countit. This, in turn, can reduce the number of calls to # &runloop a lot, and thus reduce additive errors. my $tbase = Benchmark->new(0)->[1]; - do { - $t0 = Benchmark->new(0); - } while ( $t0->[1] == $tbase ); + while ( ( $t0 = Benchmark->new(0) )->[1] == $tbase ) {} ; &$subref; $t1 = Benchmark->new($n); $td = &timediff($t1, $t0); @@ -729,7 +727,7 @@ sub cmpthese{ sort { $$a <=> $$b } map { \$_ } @col_widths[2..$#col_widths]; my $max_width = ${$sorted_width_refs[-1]}; - my $total = 0; + my $total = @col_widths - 1 ; for ( @col_widths ) { $total += $_ } STRETCHER: |