Mail rules is slow

I just tested a single mail rule which moves messages with a certain string in the subject from my inbox to a special folder. It processed my inbox at about 100 messages/second, which is not unbearable, but you could be doing much better. I presume if the rule was for the message body it could be worse. I think an improvement of at least one order of magnitude, if not two, should be possible. Maybe integrating something like Lucene or Xapian could give a lot of performance benefits for mail rules and general search as well.


(Originally posted by psivesely on GitHub.)

Hey! Yeah, I hear you—right now all mail rules run with the message bodies loaded, which is why it’s so slow. (And why it operates so slowly when new mail arrives.) I think that if we only allowed rules based on headers it’d be much much faster. I’ll take a look and see if there are any quick wins though. I think that we also intentionally throttle how fast they run to ensure the app is still usable while they’re processing, but that may not be super necessary since a few other major changes have been made in the last few years.


(Originally posted by bengotow on GitHub.)