From 5f85b848c0c828ba9f18f6e90a388ccfab9ef17a Mon Sep 17 00:00:00 2001 From: drbaggy Date: Sun, 30 May 2021 08:45:51 +0100 Subject: changed speed test so always does 2000 iterations irrespective of range... --- challenge-114/james-smith/perl/ch-2.pl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/challenge-114/james-smith/perl/ch-2.pl b/challenge-114/james-smith/perl/ch-2.pl index 589dbdc34f..c3572ec45d 100644 --- a/challenge-114/james-smith/perl/ch-2.pl +++ b/challenge-114/james-smith/perl/ch-2.pl @@ -17,18 +17,19 @@ my @sols = ( #done_testing(); my @ranges = ( - [ 4000, 1, 500 ], - [ 1000, 500, 2500 ], - #[ 100, 1_047_576, 1_049_576 ], - #[ 50, 1_073_740_824, 1_073_742_824 ], + [ 5000, 1..500,1..500,1..500,1..500 ], + [ 5000, 500..2499 ], + [ 5000, 1_047_576..1_049_575 ], + [ 5000, 1_073_740_824..1_073_742_823 ], ); foreach my $r (@ranges) { - cmpthese( $r->[0], { - 'rind2' => sub { next_bin_rindex2( $_ ) foreach $r->[1] .. $r->[2] }, - 'rind' => sub { next_bin_rrev( $_ ) foreach $r->[1] .. $r->[2] }, - 'rex' => sub { next_bin_rex( $_ ) foreach $r->[1] .. $r->[2] }, -# 'simp' => sub { next_bin( $_ ) foreach $r->[1] .. $r->[2] }, + my($c,@n) = @{$r}; + cmpthese( $c, { + 'rind2' => sub { next_bin_rindex2( $_ ) foreach @n }, + 'rind' => sub { next_bin_rrev( $_ ) foreach @n }, + 'rex' => sub { next_bin_rex( $_ ) foreach @n }, +# 'simp' => sub { next_bin($_ ) foreach @n }, }); } -- cgit