Closed 31475d12-5c49-44cd-a6d0-ae9a9c0209a4 closed 20 years ago
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.
Logged In: YES user_id=196212
Thanks for your changes - will check them in!
Logged In: YES user_id=196212
changes checked in.
Logged In: YES user_id=212920
cool idea, Carl! This is code to remember! Thanks for submitting that!
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['library']
title = 'imaplib.IMAP4_SSL: changed quadratic read() code to linear'
updated_at =
user = 'https://bugs.python.org/cwraith'
```
bugs.python.org fields:
```python
activity =
actor = 'tinolange'
assignee = 'pierslauder'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'c_wraith'
dependencies = []
files = ['5974']
hgrepos = []
issue_num = 956394
keywords = ['patch']
message_count = 4.0
messages = ['45997', '45998', '45999', '46000']
nosy_count = 3.0
nosy_names = ['pierslauder', 'tinolange', 'c_wraith']
pr_nums = []
priority = 'normal'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue956394'
versions = []
```