File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes JavaMail get IMAP folder size very slow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail get IMAP folder size very slow" Watch "JavaMail get IMAP folder size very slow" New topic

JavaMail get IMAP folder size very slow

Tod Stroszer

Joined: Oct 24, 2007
Posts: 28
I was asked to rewrite this perl code that uses perl's MAIL::IMAPClient API to get the size of an IMAP folder to Java using JavaMail. The perl looks like

The perl basically totals the rfc822 size of each message in an IMAP folder to get the total size of the folder. I rewrote this in Java like

The perl and java give identical results for IMAP folder sizes - but the Java takes *much* longer to run. For my mailboxes, the perl takes about a minute, while the Java takes about 45 minutes. I'm not sure why this is happening. Is there anything about my code, or any other factors I should be looking at that would explain why Java takes so much longer to do the same thing?
jQuery in Action, 2nd edition
subject: JavaMail get IMAP folder size very slow
Similar Threads
Compare datas
There is no Action mapped for action name prePaymentManager
jscript problems
99 bottles of beer
can i use java to check the disk usage?