[PATCH 0/13] Reintegrate imaplib2 and IDLE, again

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Feb 7 11:35:37 GMT 2011


On Sun,  6 Feb 2011 11:58:54 -0500, Ethan Glasser-Camp <ethan at betacantrips.com> wrote:
> - Patch 5: Remove WrappedIMAP4_SSL.read(). This overridden method
>   seemed to be built to interact with imaplib, but with imaplib2,
>   it prevents SSL from working. We seem to be OK without it...

Hi there,

cool work. I will try it out when I have some time. Just one comment on
the imaplib.read() implementation (because I had asked John why we
override this very function):

IMAP4_SSL.readline() implements a VERY inefficient solution, it reads
one char at a time, and copies all those fragments together to full
strings. It really sucks! That's why we have a custom _read_upto()
function which reads (I believe around 4kb) in one go, and buffers the
rest that we don't need for our readline(). That is why we also need to
override read(), so we get data that we have in that buffer first before
actually reading in new data.

So, while it would be possible to ditch _read_upto(), read(), and
.readline() for the SSL case (but just ditching read() and keeping
readline() wouldnt work!), we would get the performance penalty that
this implementation overcomes.

That's why I would be very careful in just doing away with those
overrides, I looked and imaplib2 is still doing the same thing. (there
is a python bug about that in the python bug tracker somewhere)
I haven't time the significance of the performance difference, but
wouldn't be surprised if it is quite heavy.

Just a point to consider, otherwise looking forward to IMAP IDLE (but
not to breaking my true single-threading :-))
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110207/f24b39bd/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list