Does your IMAP server support the server-side SORT feature? If not, you will have a hard time with huge folders, expecially on slower server hardware. I experienced that with Mercury (the worst of'em) and AgoSoft. Since I switched to hMailServer, no probs at all with RC and IMAP folders containing some 10,000+ emails.
Manfred