Last active
December 17, 2015 06:19
-
-
Save diakopter/5564959 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 \size = 500; | |
my \reps = 100; | |
my $a = []; | |
for 1..size { $a[$_ - 1] = $_ } | |
my $s = now; | |
for 1..reps { | |
my @b = $a[1..($a - 1)]; | |
} | |
say now - $s; | |
my $zz; | |
role items_getter { method foo { sub { return nqp::getattr(self, List, '$!items') } } } | |
my $aa := $a does items_getter; | |
$s = now; | |
for 1..reps { | |
my $t := nqp::shift($aa.foo.()); | |
my @b = nqp::clone($aa.foo.()); | |
nqp::unshift($aa.foo.(), $t); | |
} | |
say now - $s; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment