Message135166
| Author |
stutzbach |
| Recipients |
benjamin.peterson, daniel.urban, jcon, pitrou, stutzbach |
| Date |
2011年05月05日.00:35:33 |
| SpamBayes Score |
5.2323367e-07 |
| Marked as misclassified |
No |
| Message-id |
<1304555737.32.0.0606655470844.issue9971@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Looking at this again, I agree with John. For BufferedIOBase, read() is abstract while readinto() is concrete. That seems backward, and, indeed, it's the opposite of RawIOBase, where readinto() is abstract and read() is concrete.
Unfortunately, this code has shipped, so changing which methods are abstract may not be practical. On the other hand, the documentation doesn't mention which methods are abstract versus concrete.
All of that said, we can freely change the C implementation of BufferedReader which is a concrete class. That would allow us to cut out the extra allocoations/deallocations, even if we can't clean up the abstract vs concrete method issue. Basically, this would require greatly expanding buffered_readinto() in bufferedio.c to use _bufferedreader_raw_read() and related functions.
As I think about this more... I'm not sure how much performance there is to gain here in practice. It seems like any time I'd want to use readinto(), it's because I want to do my own buffering, in which case why would I use a BufferedReader? I'm thinking that BufferedIOBase only provides a readinto() method for completeness, so it can be used as a drop-in replacement for an unbuffered file object. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年05月05日 00:35:37 | stutzbach | set | recipients:
+ stutzbach, pitrou, benjamin.peterson, daniel.urban, jcon |
| 2011年05月05日 00:35:37 | stutzbach | set | messageid: <1304555737.32.0.0606655470844.issue9971@psf.upfronthosting.co.za> |
| 2011年05月05日 00:35:34 | stutzbach | link | issue9971 messages |
| 2011年05月05日 00:35:33 | stutzbach | create |
|