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