in reply to Re^2: Need a faster way to find matches
in thread Need a faster way to find matches

Doing without the array slice may improve it:
{ use integer; for my $i1 (0 .. $#LongListOfIntegers) { for my $i2 ($i1+1 .. $#LongListOfIntegers) { my $v = $LongListOfIntegers[$i1]; my $w = $LongListOfIntegers[$i2]; unless ($v & $w & ~1) { $MatchedIntegers{$v}{$w} = 1; $MatchedIntegers{$w}{$v} = 1; } } } }

Replies are listed 'Best First'.
Re^4: Need a faster way to find matches
by remzak (Acolyte) on Jan 18, 2010 at 21:18 UTC
    I tried your suggestion; on my (windows) version of perl, using the array slice is (much) faster. Still, thanks for the suggestion.