Skip to content

Instantly share code, notes, and snippets.

@diakopter
Last active December 17, 2015 06:19
Show Gist options
  • Save diakopter/5564959 to your computer and use it in GitHub Desktop.
Save diakopter/5564959 to your computer and use it in GitHub Desktop.
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