procmail
[Top] [All Lists]

Re: rules be or'ed instead anded

2001-10-10 21:01:09
Stan had suggested,

R>          :0 flags
R>          * !^To:.*email1
R>          * !^To:.*email2
R>          * !^To:.*email3
R>          * !^Subject:.*hi
R>          { }
R>          :O E

That should be :0E, of course.

R>          your-action-goes-here

Marcelo asked,

L> Yeah.. could be.. I realy didn't think that..
L> but, which one would be faster, this one, or the 1^1 one?

The double-reverse DeMorgan would, because it would zip down to the action
as soon as any of the inverted conditions failed (which is to say, as soon
as any of the conditions you really have in mind matched) instead of
continuing to test the rest of them.

You could relieve that in the score method by using the procmail supremum
(which is 2147483647 -- if that number is too much of a pain to remember,
9876543210 works just as well) instead of 1 as the w-value on each of the
conditions (well, you could still use 1 on the last condition listed).  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.

If you use 1^1 instead of 1^0, though, you get the downsides of both with
the upsides of neither.  You're testing the entire search area on every
condition instead of heading for the action as soon as procmail finds any
match to any of them.



_______________________________________________
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>