Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Unicodable 9 times faster
Not sure why would it be so much faster, but whatever. Now every query
runs under one second.
  • Loading branch information
AlexDaniel committed Dec 12, 2016
1 parent 6139b4f commit 1ba7473
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Unicodable.p6
Expand Up @@ -84,8 +84,12 @@ method process($message, $query is copy) {
@words.push: .uc
}
}
for (0..0x1FFFF).grep({ (!@words or uniname($_).contains(@words.all))
and (!@props or uniprop($_) eq @props.any) }) {
# ↓ do not touch these three lines
my $sieve = 0..0x1FFFF;
for @words -> $word { $sieve .= grep({uniname($_).contains($word)}) };
for @props -> $prop { $sieve .= grep({uniprop($_) eq $prop}) };

for @$sieve {
my $char-desc = self.get-description($_);
@all.push: $char-desc;
$message.reply: $char-desc if @all < MESSAGE-LIMIT; # >;
Expand Down

0 comments on commit 1ba7473

Please sign in to comment.