On 26 févr. 06, at 23:35, Mark Edwards wrote:
It works great for the most part on my end. Very fast now to view a message in a large box, no different than a small box.
Good.
With the one exception that if the message list is sorted by something other than date_DESC, its pretty much as bad as before -- i.e. total failure on a large box.
I still don't get why it is able to produce the index so quickly no matter what. Why can't the same indexing method be used for both making the main index of a box, and finding the prev/next UID's?
Hum, that's a good question I can't find an answer for the moment. To be sure we correctly identified the problem, could you simply replace the rcube_imap.inc::message_index function with the one below (around line 643)? This one only issues a sort command without checking the cache at all. If the problem persists when you see a new message (with the list sorted by something else than date_DESC), that's effectively strange, because it does a lot less than the _list_headers function, so should be significantly faster, or at least equal.
function message_index($mbox='', $sort_field=NULL, $sort_order=NULL) { if ($sort_field!=NULL) $this->sort_field = $sort_field; if ($sort_order!=NULL) $this->sort_order = strtoupper($sort_order);
$mailbox = $mbox ? $this->_mod_mailbox($mbox) : $this->mailbox;
$key = "$mbox:".$this->sort_field.":".$this->sort_order.".msgi";
// fetch complete message index
// will only work if sorting is enabled (we normally don't need
this method with default sorting) if ($this->get_capability('sort') && ($a_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, '', TRUE))) { if ($this->sort_order == 'DESC') $a_index = array_reverse($a_index);
$this->cache[$key] = $a_index;
}
return $this->cache[$key];
}
To further test, I would also like you to get the running time of the commands directly sent to the imap server. You could do something like $ telnet imap-server.example.org 143 LOGIN username password SELECT your_huge_mailbox_name SORT (SUBJECT) US-ASCII ALL # how much time does it take to get the answer? UID SORT (SUBJECT) US-ASCII ALL # how much time does it take to get the answer?
Hope this will help finding a better solution,
Regards,
-l
Side note: shouldn't we set $IMAP->skip_deleted to TRUE and always search or sort 'ALL UNDELETED'?