1
0
Fork 0
mirror of https://git.sr.ht/~rjarry/aerc synced 2026-02-17 19:58:16 +01:00
aerc/worker/notmuch/lib
Rex Fernando 2682f58ed8 notmuch: only read message headers when sorting
Previously, the notmuch worker's sort() method was using
rfc822.MessageInfo() in order to retrieve info about each message for
sorting. This method seems to parse the entire body of the message, so
it does much more work than needed for sorting. In contrast, the maildir
worker's sort() method uses rfc822.MessageHeaders(), which only parses
the headers, and is much faster. I noticed that on a large mailbox with
~60k messages, the maildir backend loads in a few seconds, whereas the
notmuch backend takes half a minute.

This patch switches the notmuch worker's sort() method to use
rfc822.MessageHeaders(). It also includes logic to skip sorting if the
sort criterion matches that of the notmuch results.

Signed-off-by: Rex Fernando <rex@nnphy.me>
Acked-by: Robin Jarry <robin@jarry.cc>
2026-02-10 11:06:15 +01:00
..
database.go notmuch: only read message headers when sorting 2026-02-10 11:06:15 +01:00