procmail
[Top] [All Lists]

Re: Thoughts on speed-up?

1999-12-02 08:25:43
Brock Rozen <brozen(_at_)torah(_dot_)org> writes:
I have so many list filters that it can take up to a minute for an email
to get processed by them all and finally hit my INBOX (in the assumption
that it matches none of them).

That's annoying.

Hmm, do you have a global lockfile?  If you turn on verbose logging, where
do the timestamps show the time is being taken?


I realized that while I may have (for example) 5 filters, it might be of
benefit to have one "pre-filter" that does the exact same thing all of
them do. If it doesn't match that one "pre-filter" then it can move along,
avoiding all five for a net gain of 4 filters avoided. If it does match,
then all it's done is hit an additional filter. If I have "groups" of
filters, then there might even be a net gain for most filters, needless to
say for my INBOX (which is the most important of all).

Simply putting a filter that searches for my name in the TO or CC headers
isn't good enough, because many times a list will contain that as well.

So it would look like this:

:0
* ^TO_(listone|second|third|fourth)
      {
      :0
      * ^TO_listone
      listone

      :0
      * ^TO_second
      second

      :0
      * ^TO_third
      third

      :0
      * ^TO_fourth
      fourth
      }

The following will be faster, though it has ever so slightly different
semantics:

        :0
        * ^TO_\/(listone|second|third|fourth)
                {
                :0
                * MATCH ?? ^^listone
                listone

                :0
                * MATCH ?? ^^second
                second

                :0
                * MATCH ?? ^^third
                third

                :0
                * MATCH ?? ^^fourth
                fourth
                }

The difference is that if a message arrives that is ^TO_ two or more
of the lists, your recipe will file it under the first of listone,
second, ...  while the recipe using MATCH will file it under the one
that occurs earlier in the header.  A message with headers:
        To: second
        Cc: listone

would be filed under listone by your recipe and under second by my recipe.

If that's not a concern, then the above is the way to go.


Philip Guenther

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