Skip to content

Commit

Permalink
Optimize lexical out of hot loop in "uniq"
Browse files Browse the repository at this point in the history
And I've now given up on using grep{} in uniq(), the tests succeeed, but strange
unrelated things change, like giving the wrong error message:
$ perl6 -e 'Module.new'
===SORRY!===
Cannot assign a non-Perl 6 value to a Perl 6 container
  • Loading branch information
lizmat committed Jul 3, 2013
1 parent ce8b5f6 commit f60a2c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/List.pm
Expand Up @@ -326,8 +326,9 @@ my class List does Positional {
# specifier, but AFAIK nothing has been spec'd yet.
method uniq() {
my $seen := nqp::hash();
my str $which;
gather sink for @.list {
my str $which = nqp::unbox_s($_.WHICH);
$which = nqp::unbox_s($_.WHICH);
unless nqp::existskey($seen, $which) {
take $_;
nqp::bindkey($seen, $which, 1);
Expand Down

0 comments on commit f60a2c1

Please sign in to comment.