Message193496
The read1() docstring says: "Reads up to n bytes, with at most one read() system call."
However, in the implementation read1() calls peek() to refill the buffer if necessary, and then returns whatever is available in the buffer.
This means that read1() will only return up to n bytes if n is smaller than the buffer size, otherwise it will return at most <buffer-size> bytes.
With the current implementation, running a loop that calls obj.read1(n) for large n is therefore much less performant than a loop that calls obj.raw.read(n).
I think a call to read1(n) with empty buffer should always attempt to read n bytes from the raw stream, i.e. the implementation should be changed to match the documentation. |
|
Date |
User |
Action |
Args |
2013-07-22 04:56:16 | nikratio | set | recipients:
+ nikratio |
2013-07-22 04:56:15 | nikratio | set | messageid: <1374468975.95.0.466613665533.issue18524@psf.upfronthosting.co.za> |
2013-07-22 04:56:15 | nikratio | link | issue18524 messages |
2013-07-22 04:56:15 | nikratio | create | |
|