[issue2523] binary buffered reading is quadratic

Antoine Pitrou report at bugs.python.org
Tue Jul 22 00:59:13 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

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?

> IIUC, io.open will always return a BufferedReader, potentially with
> buffer_size=0 for unbuffered IO. This case must be supported.

No, io.open returns the raw object without wrapping it:

    if buffering == 0:
        if binary:
            raw._name = file
            raw._mode = mode
            return raw
        raise ValueError("can't have unbuffered text I/O")

We could even decide to raise a ValueError when trying to construct a
BufferedReader with a buffer_size < 1.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2523>
_______________________________________


More information about the Python-bugs-list mailing list