Skip to content

Instantly share code, notes, and snippets.

@samcv
Created February 1, 2017 11:41
Show Gist options
  • Save samcv/3bf513759424aae24ae32fa616c278ff to your computer and use it in GitHub Desktop.
Save samcv/3bf513759424aae24ae32fa616c278ff to your computer and use it in GitHub Desktop.
use nqp;
#proto sub infix:<unicmp>(Str \a, Str \b) is pure { * }
my %decomp_spec;
my @list;
my @dec = "ABC", "04D", "ABC", "04D";
# 1.5s
for ^10000 -> $cp {
my @array;
push %decomp_spec{$cp}<mapping>, nqp::atpos(nqp::radix(16, $_, 0, 0), 0) for @dec;
}
# 0.5s
for ^10000 -> $cp {
my @array;
for @dec { @array.push(nqp::atpos(nqp::radix(16, $_, 0, 0), 0)) }
%decomp_spec{$cp}<mapping> = @array;
}
say now - INIT now;
say %decomp_spec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment