in reply to Re: How can I improve the efficiency of this very intensive code?
in thread How can I improve the efficiency of this very intensive code?
On second look, I have to wonder what the purpose of the 'last' is being in a for loop, outside of a conditional. If that is what you wanted you could just take the first element of the array returned to by sort, and run the if {} on that.sub IsStrongMatch { # Return true if id2 is only top ranked match for id1 my $id1 = shift; my $id2 = shift; my $rC = shift; for my $i1 ( keys %{$rC} ) { next if $i1 == $id1; foreach my $i2 ( sort { $rC->{$i1}->{$a} <=> $rC->{$i1}->{$b} +} keys %{$rC->{$i1}} ) { if ( $id2 == $i2 ) { return 0; } last; } } return 1; }
Evan Carroll
www.EvanCarroll.com
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How can I improve the efficiency of this very intensive code?
by mrborisguy (Hermit) on Aug 06, 2005 at 23:16 UTC | |
by polettix (Vicar) on Aug 07, 2005 at 00:07 UTC | |
Re^3: How can I improve the efficiency of this very intensive code?
by clearcache (Beadle) on Aug 06, 2005 at 22:37 UTC |
In Section
Seekers of Perl Wisdom