[Patches] [ python-Patches-956394 ] imaplib.IMAP4_SSL: changed quadratic read() code to linear

SourceForge.net noreply at sourceforge.net
Tue May 18 21:15:24 EDT 2004


Patches item #956394, was opened at 2004-05-18 18:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=956394&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Carl Howells (c_wraith)
Assigned to: Nobody/Anonymous (nobody)
Summary: imaplib.IMAP4_SSL: changed quadratic read() code to linear

Initial Comment:
read() in imaplib.IMAP4_SSL used string concatenation
with += in a loop.  This lead to exceptionally poor
performance retreiving large email messages.

Changed both read() and readline() in IMAP4_SSL to
aggregate string fragments in a list, then join the
elements of the list before returning them.  This
replaces an O(n^2) algorithm with an O(n) algorithm,
for a significant speed increase when retreiving large
email messages.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=956394&group_id=5470



More information about the Patches mailing list