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

SourceForge.net noreply at sourceforge.net
Wed May 19 20:50:39 EDT 2004


Patches item #956394, was opened at 2004-05-19 11:15
Message generated for change (Comment added) made by pierslauder
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: Accepted
Priority: 5
Submitted By: Carl Howells (c_wraith)
Assigned to: Piers Lauder (pierslauder)
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.

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

>Comment By: Piers Lauder (pierslauder)
Date: 2004-05-20 10:50

Message:
Logged In: YES 
user_id=196212

Thanks for your changes - will check them in!


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

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