foens / hpop

OpenPOP.NET code repository
http://hpop.sourceforge.net/
202 stars 114 forks source link

When loading/reading emails from the hard disk it's very slow is there anything to do about it ? #48

Closed Csharper1972 closed 8 years ago

Csharper1972 commented 8 years ago

Slow i mean in many cases the hard disk think a lot or the program even stop for some seconds. This is my code in a backgroundworker dowork event

int countUploadMsg = 0; private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { int counter = 0; allLoadedMessages = new List<OpenPop.Mime.Message>(); OpenPop.Mime.Message loadedMessage = null; DirectoryInfo di = new DirectoryInfo(@"e:\testmail\"); FileInfo[] files = di.GetFiles();//new FileInfo(@"e:\testmail\" + emailNumber + ".eml"); foreach (FileInfo file in files) { loadedMessage = OpenPop.Mime.Message.Load(file); allLoadedMessages.Add(loadedMessage); counter += 1; int nProgress = counter * 100 / files.Length; backgroundWorker2.ReportProgress(nProgress); } }

It's working but get slow in some places while loading/reading the emails from the hard disk. The files on the hard disk are .eml the biggest are 8.5MB and htere are smaller like 23KB

I saw this problem with someone else here:

http://stackoverflow.com/questions/24364402/how-to-parse-emails-faster-than-openpop-dll

There is explaining there about the problem but the solution is to work with other library and i want to keep working with OpenPop. The question is if there is anything to do with this problem ?

foens commented 8 years ago

I wouldn't think it was directly slow. However, you are free to improve the performance of the library. You might also take a look at MimeKit. It has been optimized rigorously.