You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2008/12/29 15:56:13 UTC
svn commit: r729906 - /spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm
Author: jm
Date: Mon Dec 29 06:56:12 2008
New Revision: 729906
URL: http://svn.apache.org/viewvc?rev=729906&view=rev
Log:
bug 5931: trusted_networks bogs down due to O(n^2) loop with millions of entries; revisit -- we still want to keep the check if possible, so just skip the O(n^2) linting code if we have over 200 networks in the list
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm?rev=729906&r1=729905&r2=729906&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm Mon Dec 29 06:56:12 2008
@@ -80,9 +80,12 @@
$ip6 = $ip;
}
- # bug 5931: this is O(n^2). bad if there are lots of nets, and
- # it's harmless to have duplicates anyway
- # next if ($self->is_net_declared($ip4, $ip6, $exclude, 0));
+ # bug 5931: this is O(n^2). bad if there are lots of nets. There are good
+ # reasons to keep it for linting purposes, though, so don't start skipping
+ # it until we have over 200 nets in our list
+ if (scalar @{$self->{nets}} < 200) {
+ next if ($self->is_net_declared($ip4, $ip6, $exclude, 0));
+ }
# note: it appears a NetAddr::IP object takes up about 279 bytes
push @{$self->{nets}}, {