Created
March 28, 2018 22:27
-
-
Save samcv/5c5c9916d42eca70ae87af87a5dfe9cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $*test-count = 0; | |
my @results; | |
my $b1 = { .defined }; | |
my $b2 = { 0 ≤ $_ }; | |
my @blocks = $b1, $b2; | |
test-it({ | |
my $b = 'a' x 999999 ~ 'b'; | |
$b ~~ /b/ for ^400; | |
}, | |
#$b1, | |
1); | |
test-it({ | |
my $b = 'a' x 999999 ~ 'b'; | |
use nqp; | |
nqp::index($b, 'b', 0); | |
}, | |
#$b2, | |
1); | |
sub test-it (&code, Int:D $times = 1) { | |
my $t1 = now; | |
my Mu $rtrn; | |
for ^$times { | |
$rtrn = &code(); | |
} | |
#die "Got `$rtrn.perl()` back on test {++$*test-count}, which is wrong" unless @blocks[$*test-count]($rtrn); | |
my $tot = now - $t1; | |
@results.push: $tot; | |
say "Test {++$*test-count}: $tot s"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment