Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 Murach's Java Servlets and JSP this week in the Servlets 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?
I agree. Here's the link:
subject: JavaMail get IMAP folder size very slow
Similar Threads
There is no Action mapped for action name prePaymentManager
jscript problems
99 bottles of beer
can i use java to check the disk usage?
Compare datas