Skip to content
Permalink
Browse files

streamline postcircumfix:<[ ]> for CArray

makes it a little more than 2x faster
  • Loading branch information...
timo committed Dec 25, 2018
1 parent 4fc7bef commit f009cb4a5990fda7f741fcc529627c4a37320d6c
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/NativeCall.pm6
@@ -583,7 +583,7 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
}

multi sub postcircumfix:<[ ]>(CArray:D \array, $pos) is raw is export(:DEFAULT, :types) is default {
$pos ~~ Iterable ?? $pos.map: { array.AT-POS($_) } !! array.AT-POS($pos);
nqp::istype($pos, Iterable) ?? $pos.map: { array.AT-POS($_) } !! array.AT-POS($pos);
}
multi sub postcircumfix:<[ ]>(CArray:D \array, *@pos) is raw is export(:DEFAULT, :types) {
@pos.map: { array.AT-POS($_) };

0 comments on commit f009cb4

Please sign in to comment.
You can’t perform that action at this time.