atom feed2 messages in net.sourceforge.lists.courier-users[courier-users] Patch: Emacs Gnus aga...
FromSent OnAttachments
Marc HorowitzAug 31, 2004 7:59 pm 
Sam VarshavchikSep 1, 2004 4:11 am 
Subject:[courier-users] Patch: Emacs Gnus against Courier-IMAP is slow
From:Marc Horowitz (ma@mit.edu)
Date:Aug 31, 2004 7:59:05 pm
List:net.sourceforge.lists.courier-users

Gnus has a habit of executing IMAP commands like this one:

663 UID SEARCH UID 5906:5910

If the folder is large, this is very slow. Using strace on imapd, I observed that the daemon is opening and reading the contents of many of the files in the folder.

After some code inspection, it looks like this is a bug in imap/search.c, which does not short-circuit a negative test for search_uid. This patch (against CVS sources) seems to fix the problem. It is essentially identical in structure to the search_messageset code just above. strace shows that with the patch, the query result is computed with no additional I/O at all:

read(0, "663 UID SEARCH UID 5906:5910\r\n", 8192) = 30 time([1093984694]) = 1093984694 select(2, NULL, [1], NULL, {60, 0}) = 1 (out [1], left {60, 0}) write(1, "* SEARCH 5906 5907 5908 5909 5910\r\n663 OK SEARCH done.\r\n", 56)
= 56

Is this the right place to send this fix, or should I send it somewhere else?

Marc

--- search.c.orig 2004-08-31 15:36:12.000000000 -0400 +++ search.c 2004-08-31 15:36:55.000000000 -0400 @@ -453,6 +453,8 @@ case search_uid: if (is_in_set(p->as, current_maildir_info.msgs[msgnum].uid)) p->value=1; + else + p->value=0; break; case search_reverse: p->value=1;

Marc