in reply to Re: Need a faster way to find matches
in thread Need a faster way to find matches
I am not a perl whiz, and do not know how to "remove a level of scope" in the syntax below.
"use integer" helps, and more so (i think) when I moved it outside of the loop.
the "grep $_ &1, @LongListOfIntegers" doesn't do anything since I know the values are all odd.
The last idea provided the most savings. I do need both values as keys in the hash, since I am using this as a lookup in subsequent steps.
Thanks. Now I am going to investigate kikuchiyo's comments.{ use integer; foreach my $i1 ( 0 .. $#LongListOfIntegers) { my $v = $LongListOfIntegers[ $i1 ]; foreach (@LongListOfIntegers[ $i1+1 .. $#LongListOfIntegers]) { if (($v & $_) == 1) { $MatchedIntegers{$v}{$_}=(); $MatchedIntegers{$_}{$v}=(); } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Need a faster way to find matches
by remzak (Acolyte) on Jan 17, 2010 at 19:29 UTC | |
|
Re^3: Need a faster way to find matches
by repellent (Priest) on Jan 18, 2010 at 04:12 UTC | |
by remzak (Acolyte) on Jan 18, 2010 at 21:18 UTC |