[Dovecot] Dovecot-sieve processing optimizations
I'm working at the next part of the virtual domains mail server. I'm moving this account (raanders@acm.org is a forwarder) which has a bunch of procmail rules to file into folders.
My question is if it is more efficient is use?
if { ... } elsif { ... } elsif { ... } else
This seems to be the way many of the example scripts do it but I found at least one that used
if { ... }
if { ... }
Which is more procmail like and for me reads easier.
If not here where should I ask?
Thanks, Rod
Roderick A. Anderson wrote:
I'm working at the next part of the virtual domains mail server. I'm moving this account (raanders@acm.org is a forwarder) which has a bunch of procmail rules to file into folders.
My question is if it is more efficient is use?
if { ... } elsif { ... } elsif { ... } else
This seems to be the way many of the example scripts do it but I found at least one that used
if { ... }
if { ... }
Which is more procmail like and for me reads easier.
If not here where should I ask?
Well, both accomplish different things. In the first example, one and only one of the conditions will be executed. In the second one, more than one could possibly be executed.
I've never looked at Sieve's code, but the first will stop at the first matching condition. In the second case, because you could make it do more than one thing, it must check each condition.
~Seth
Seth Mattinen escreveu:
Roderick A. Anderson wrote:
I'm working at the next part of the virtual domains mail server. I'm moving this account (raanders@acm.org is a forwarder) which has a bunch of procmail rules to file into folders.
My question is if it is more efficient is use?
if { ... } elsif { ... } elsif { ... } else
This seems to be the way many of the example scripts do it but I found at least one that used
if { ... }
if { ... }
Which is more procmail like and for me reads easier.
If not here where should I ask?
Well, both accomplish different things. In the first example, one and only one of the conditions will be executed. In the second one, more than one could possibly be executed.
I've never looked at Sieve's code, but the first will stop at the first matching condition. In the second case, because you could make it do more than one thing, it must check each condition.
If in each if you put a "finish" statement (or whatever is used to stop processing the file), then the second one can be more efficient, since it does not have to continue checking the file to see if there are further conditions after the if/elseif/.../else block.
But in practice I doubt there is a practical difference between both. You should use the one that is more readable for you.
-- Eduardo M Kalinowski eduardo@kalinowski.com.br
Eduardo M KALINOWSKI wrote:
Seth Mattinen escreveu:
<snip />
Seth, Eduardo;
Thanks.
Seth,
As I read your post -- slap went my hand to my forehead. I knew that! That was the subconsciouses reason I asked I'm sure. :-)
Eduardo,
You're right. What I'm doing, currently, isn't all that complicated. In fact mail sieve will make it easier, simpler, and cleaner to do. I only once really got into doing anything complex using procmail and I'm not using it now.
Again thanks to you both, Rod
Well, both accomplish different things. In the first example, one and only one of the conditions will be executed. In the second one, more than one could possibly be executed.
I've never looked at Sieve's code, but the first will stop at the first matching condition. In the second case, because you could make it do more than one thing, it must check each condition.
If in each if you put a "finish" statement (or whatever is used to stop processing the file), then the second one can be more efficient, since it does not have to continue checking the file to see if there are further conditions after the if/elseif/.../else block.
But in practice I doubt there is a practical difference between both. You should use the one that is more readable for you.
participants (3)
-
Eduardo M KALINOWSKI
-
Roderick A. Anderson
-
Seth Mattinen