osbosb has asked for the wisdom of the Perl Monks concerning the following question:
Cpan says:#!/usr/bin/perl use strict; use warnings; use Benchmark qw(timethis); my @bin = glob("/bin/*"); timethis(-2, { one => 'sort { -s $a <=> -s $b } @bin', two => 'map $_->[0], sort { $a->[1] <=> $b->[1] } map [ +$_, -s $_], @bin' } );
Execution:timethese(0, { test1 => '...', test2 => '...'})
What am I missing?$ perl thing usage: $result = timethis($time, 'code' ); or $result = timethis($time, sub { code } );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Benchmark - timethis syntax?
by choroba (Cardinal) on Sep 01, 2011 at 16:14 UTC | |
by osbosb (Monk) on Sep 01, 2011 at 17:02 UTC |