+1 vote

I'm looking for ways to speed up the process of retrieving emails you already have the folder / UID for.

Currently (through my own profiling) the Select takes by far the longest (something like 1-2 second to select an 'All Mail' folder within a gmail account with 100,000 emails).

I'm caching as much as I can (the UIDs themselves are cached, the folder list, etc).

I want to understand more about what's happening during the Select folder process. Secondarily if there is a way to improve performance of the connection itself (aside from keeping them in memory - this is not an option given the number of instances this code is running on).

Thanks.

by (350 points)
I suggest you turning on logging if you want to understand what's going on on the protocol level:
https://www.limilabs.com/blog/logging-in-mail-dll

1 Answer

0 votes

Select method issues SELECT command. It is a single IMAP command. If it takes time, most likely it is a server fault, as this command isn't returning much data for Mail.dll to process.

by (301k points)
...