I have noticing that one of my webmail servers has been running slower than the other. At first I put it down to being a single disk compared to a raid array, then I thought it might be that the hard disk controller had issues under linux (it took for ever to build a mirror disk). I just swapped the drives to dedicated controller card and it seemeda little faster. Then I came across this today https://www.squirrelmail.org/wiki/SquirrelMailPerformance
You should be able to check whether your IMAP server supports SORT and Threading by talking to it:
> telnet imapserver.example.com imap
* OK
2 capability
* CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN STARTTLS
2 OK CAPABILITY completed
Notice the SORT and THREAD capabilities. So this server (courier-imap in this case) supports these.
Now tell SquirrelMail to use them, in the “configure” program:
4. General Options
11. Allow server thread sort: false (default) -> true
12. Allow server-side sorting: false (default) -> true
I enabled the two options and now it is really fast.