procmail
[Top] [All Lists]

Re: rules be or'ed instead anded

2001-10-10 21:38:24
"David W. Tamkin" <dattier(_at_)ripco(_dot_)com> writes:
...
If
all the tests are for the presence of a string or pattern, that might even
be faster than the double-reverse DeMorgan, because procmail will stop
looking for a non-negated regexp condition (if it is unweighted or the
x-value is 0) as soon as it finds one occurrence, but for a negated regexp
it will keep egrepping the entire search area to make sure it doesn't appear
anywhere in there.

I agree with everything David said, except for the above sentence.
The comparison in the sentence is between apples and oranges: you can't
compare a non-negated regexp condition stopping on the first occurence
with a negated regexp condition not finding any matches after searching
the entire area and draw the conclusion that the non-negated is therefore
faster.

Keep your eye on the end result: the action is performed only if none
of the regexps matches.  That means that if the action is performed
procmail will have (already) searched the entire search area for each of
the regexps, period.  You can optimize the "action not performed" case
in various ways (DeMorgan's law or supremum weight) but without changing
the regexps themselves, you can't optimize the "action is performed" case.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>