Ticket #1485105 (closed Bugs: wontfix)

Opened 6 months ago

Last modified 6 months ago

Bypass costly PHP message sorting if IMAP server support SORT

Reported by: jeblair Owned by:
Priority: 5 Milestone: 0.2-alpha
Component: PHP backend Version: 0.1.1
Severity: normal Keywords: imap sort
Cc:

Description

If an IMAP server supports SORT, RoundCube still sorts the message headers in rcube_imap (using the sorter class) nonetheless. This operation can be expensive on large mailboxes. Instead, it should take advantage of the fact that the UIDs it gets from the IMAP server are already sorted. The only part of the code wrapped by if(!$headers_sorted) that needs to be run on output from an IMAP server that supports SORT is potentially reversing the array at the end.

I'm attaching a patch that separates the functionality of sorting and reversing, so that the headers are sorted or reversed only when needed.

Attachments

sort.diff (1.0 kB) - added by jeblair 6 months ago.
Patch to rcube_imap to sort only when necessary

Change History

Changed 6 months ago by jeblair

Patch to rcube_imap to sort only when necessary

Changed 6 months ago by francesco_r

I think the big problem of slow speed regarding Roundcube is that sort ALL the messages. For example i use Courier-Imap: very stable but also very slow... so when i do a server-side sorting it takes 40-50 seconds to open a mailbox with 10000 messages. In the same server Squirrelmail open the inbox in 1 second. Because it sort only the first 40 messages and not the entire inbox. So i think would be nice to sort only the messages present in the actual list.

Changed 6 months ago by alec

  • milestone changed from later to 0.2-alpha

Changed 6 months ago by thomasb

  • status changed from new to closed
  • resolution set to wontfix

This is not correct. The fetch header command does not necessarily return the headers in the same order as the UIDs are requested. This can be considered as a bug of some IMAP servers but it's the reality. For this reason, the message headers need to be sorted "manually".

However, only the current message set (one page) needs to be sorted. In r1431 I tried to improve the sorting algorithm by omitting array_search which obviously had to iterate the complete message index.

Note: See TracTickets for help on using tickets.