6 messages in net.sourceforge.lists.courier-users[courier-users] Sorting speed
FromSent OnAttachments
James KnightAug 28, 2001 4:10 am 
James KnightAug 29, 2001 1:57 am 
James KnightAug 29, 2001 2:05 am 
Sam VarshavchikAug 29, 2001 4:43 am 
James KnightAug 29, 2001 1:03 pm 
Sam VarshavchikAug 29, 2001 2:40 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] Sorting speedActions...
From:James Knight (jkni@fuhm.net)
Date:Aug 28, 2001 4:10:38 am
List:net.sourceforge.lists.courier-users

I'm somewhat mystified as to why searching goes fairly quickly, but sorting takes ages in the following case: Mailbox with ~1000 messages, and ~10 that match the search. Pentium 233 (not blazingly fast. :P)

Caling: imap_search("UNSEEN UNDELETED", SE_UID) takes ~2 seconds and imap_sort($mbox, SORTARRIVAL, 0, SE_UID, "UNSEEN UNDELETED") takes ~8 seconds.

Now what's confusing me is that the number of records returned by the search is < 10. It can't possibly take 6 seconds to run qsort on 10 records, so I'm somewhat at a loss as to what its doing in the extra 6 seconds. Even adding more search queries to the search (like SINCE "1 Jan 1980 12:00 GMT") doesn't make the time any closer. It also seems to not depend on the actual sorting criteria requested. I looked at the code a bit but nothing jumped out at me as being hugely time consuming in the sort routine as compared to the search routine. If noone else has an idea about what's going on I'll look harder.

For now, turning off the server-side sort capability is a workaround, as the client can obviously sort 10 records much faster than 6 seconds.

James