Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'append': 0.07; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '2.7.3': 0.16; 'from:addr:pitrou.net': 0.16; 'from:addr:solipsis': 0.16; 'from:name:antoine pitrou': 0.16; 'imap4': 0.16; 'message- id:@post.gmane.org': 0.16; 'perl.': 0.16; 'received:213.41.240': 0.16; 'received:213.41.240.54': 0.16; 'received:80.91.229.3': 0.16; 'received:charlus.yi.org': 0.16; 'received:plane.gmane.org': 0.16; 'received:yi.org': 0.16; 'seconds.': 0.16; 'subject:slow': 0.16; 'issue,': 0.17; 'code.': 0.20; 'libraries': 0.22; 'tried': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'noticed': 0.28; 'reply.': 0.28; 'appending': 0.29; 'bad.': 0.29; 'cpu': 0.29; 'i/o': 0.29; 'perl': 0.29; 'writes:': 0.29; "i'm": 0.29; 'seconds': 0.30; 'code': 0.31; 'problem.': 0.32; '5000': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'done': 0.34; 'server': 0.35; 'there': 0.35; 'received:org': 0.36; 'charset:us-ascii': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'procedure': 0.61; 'profile': 0.61; 'different': 0.63; 'results': 0.65; 'taking': 0.65; 'inbox.': 0.78; 'antoine.': 0.84; 'url:pro': 0.84; 'subject:very': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Antoine Pitrou Subject: Re: append in IMAP4 from imaplib very slow Date: Wed, 25 Jul 2012 23:57:55 +0000 (UTC) References: <5010314F.80001@abusix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 213.41.240.54 (Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343260695 news.xs4all.nl 6952 [2001:888:2000:d::a6]:59523 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26051 Simon Pirschel abusix.org> writes: > > Hi, > 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. > 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. > The difference is huge and I tried to narrow the issue down by > profiling the Python code. > The profile results are, 206 seconds are spent in calling > socket.recv. This just means that most of the time is spent waiting for the server to reply. Perhaps the Perl and Python IMAP libraries use different IMAP commands for appending? Regards Antoine. -- Software development and contracting: http://pro.pitrou.net