[issue2523] binary buffered reading is quadratic
Alexandre Vassalotti
report at bugs.python.org
Wed Jul 23 05:02:31 CEST 2008
Alexandre Vassalotti <alexandre at peadrop.com> added the comment:
Antoine wrote:
> Le lundi 21 juillet 2008 à 21:18 +0000, Martin v. Löwis a écrit :
> > IIUC, a read of the full requested size would achieve exactly that:
on a
> > non-blocking stream (IIUC), a read will always return
> > min(bytes_available, bytes_requested).
>
> Hmm, it seems logical indeed... Alexandre, do you have other
information
> on the subject?
Martin is right. However, I don't how Python handle the case where
bytes_available is zero (in C, an error value is returned and errno is
set to EWOULDBLOCK).
When I revised the patch I had a weak understanding of nonblocking I/O.
I thought the "exponential" reads were for nonblocking I/O, but I see
now that is non-sense.
I am not sure, but I think Martin is also right about the second loop.
The max() call should be changed back to "max(self.buffer_size, n))",
like in the 2nd patch.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2523>
_______________________________________
More information about the Python-bugs-list
mailing list