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

SourceForge.net noreply at sourceforge.net
Sun Jul 11 23:05:54 CEST 2004


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

Category: Library (Lib)
Group: None
Status: Closed
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: Tino Lange (tinolange)
Date: 2004-07-11 23:05

Message:
Logged In: YES 
user_id=212920

cool idea, Carl! This is code to remember!
Thanks for submitting that!

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

Comment By: Piers Lauder (pierslauder)
Date: 2004-05-20 03:17

Message:
Logged In: YES 
user_id=196212

changes checked in.


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

Comment By: Piers Lauder (pierslauder)
Date: 2004-05-20 02: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