imapclient Gmail search() times

Grant Edwards invalid at invalid.invalid
Fri Mar 14 14:53:57 EDT 2014


I'm working on a small app to help sort/organize my mail via Gmail's
IMAP server, and I'm using imapclient (BTW it's a _huge_ improvement
over imaplib).

The odd thing I'm seeing is that when searching a large "folder" (All
Mail), I get wildly different times depending on what header I search.

  allmail = IMAPClient(HOST, use_uid=True, ssl=True, port=993)
  allmail.login(USERNAME, PASSWORD)
  allmail.select_folder('[Gmail]/All Mail')

Searching on "Message-Id:" is fast (sub-second):

  irt = allmail.search('HEADER Message-ID %s' % msgid)

Searching on "In-Reply-To:" takes 10-15 seconds:

  rt  = allmail.search('HEADER In-Reply-To %s' % msgid)

[IIRC, I've got about 22000 messages in the 'All Mail' "folder".]

I'm assuming this is just due to the way that Google implmented their
IMAP server code, but I thought I'd ask if anybody else had noticed
this.  Perhaps I'm doing something stupid, but I can't imagine what it
would be....
  
-- 
Grant Edwards               grant.b.edwards        Yow! I have a TINY BOWL in
                                  at               my HEAD
                              gmail.com            



More information about the Python-list mailing list