https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5931





--- Comment #9 from Justin Mason <[email protected]>  2008-12-29 06:56:24 PST ---
(In reply to comment #7)
> > I would much prefer that the existing
> > check be performed until the amount of ranges inputted makes it impractical
> > to do so (say when 200 ranges are added it skips the O(N^2) bit).
> 
> That's a sensible compromise.

I've now implemented that on trunk:

: 260...; svn commit -m "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" lib/Mail/SpamAssassin/NetSet.pm
Sending        lib/Mail/SpamAssassin/NetSet.pm
Transmitting file data .
Committed revision 729906 ( 
https://svn.apache.org/viewcvs.cgi?view=rev&rev=729906 ).


> Btw, I wonder if cases of several thousand entries are more common
> than anticipated. If they are, it might make sense to provide an
> alternative mechanism, much faster but less flexible, like a
> hash table of classful network addresses. For an IPv4 address,
> four hash lookups would suffice for a check, regardless of the
> size of a hash table (practically a constant access time).
> Both methods would not combine well (in presence of overlapping
> ranges), but chosing one or another would be a good option.
> (btw, these two lookup types are offered by amavisd-new).

I'd be happy to see that as a plugin ;)


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to