append in IMAP4 from imaplib very slow
Simon Pirschel
sp at abusix.org
Thu Jul 26 07:55:45 EDT 2012
On 07/26/2012 11:25 AM, Simon Pirschel wrote:
> Ok, forget about the EXISTS and RECENT response. The server will
> response this way if you selected a mailbox, which I did in the Python
> code but not in the Perl code. I disabled selecting the mailbox in
> Python and there is no difference in the runtime. So, this isn't the
> issue.
I solved the issue. The bad performance is caused by the socketopt
socket.TCP_NODELAY set to 0 by default.
Request timing with socket.TCP_NODELAY=0: 0.0501310825348 seconds
Request timing with socket.TCP_NODELAY=1: 0.0027711391449 seconds
This is a huge difference. Setting TCP_NODELAY=1 will bring the runtime
from 3:30 minutes down to 14 seconds! Not Perl speed, but close.
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120726/95f971b6/attachment.html>
More information about the Python-list
mailing list