This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaMail get IMAP folder size very slow  RSS feed

Tod Stroszer
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!