<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    I'm currently experimenting with IMAP using Python 2.7.3 and IMAP4
    from imaplib. I noticed the performance to be very bad. I read 5000
    files from a directory and append them to an IMAP INBOX. The hole
    procedure of reading and appending is taking about 210 seconds.<br>
    <br>
    I set up the exact same code in Perl to check if there is a general
    IMAP server configuration issue, since CPU and I/O isn't the
    problem. The same amount of data on the same IMAP server is done
    after 7.9 seconds using Perl.<br>
    <br>
    The difference is huge and I tried to narrow the issue down by
    profiling the Python code.<br>
    The profile results are, 206 seconds are spent in calling
    socket.recv.<br>
    <br>
    Python Code:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="http://pastebin.com/EWnfpsZB">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
    </a><a href="http://pastebin.com/d2c9d4Dx">http://pastebin.com/d2c9d4Dx</a><br>
    Profile Result:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="http://pastebin.com/rWCS8tAz">http://pastebin.com/rWCS8tAz</a><br>
    Perl Code:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="http://pastebin.com/ZV3Yv74d">http://pastebin.com/ZV3Yv74d</a><br>
    <br>
    Maybe someone can explain what's the problem, or help me debugging
    the issue.<br>
    <br>
    Thanks,<br>
    Simon<br>
  </body>
</html>