classification
Title: Cache lines in StreamReader.readlines
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, loewis (2)
Priority: normal Keywords patch

Created on 2005-08-24 14:13 by loewis, last changed 2005-09-18 08:46 by loewis.

Files
File name Uploaded Description Edit Remove
codecs.diff loewis, 2005-08-24 17:22 Version 2
Messages (3)
msg48667 - (view) Author: Martin v. Löwis (loewis) Date: 2005-08-24 14:13
Currently, the splitlines result is discarded, and only
the first line is used. Then, when another line is
requested, the rest string is split again.

With this patch, the splitlines result is preserved if
it has more than two lines, and subsequent .readline
calls get their results from self.linebuffer.
Data is either in self.linebuffer or self.charbuffer;
read() converts the linebuffer back to a charbuffer in
case somebody mixes .read and .readline calls.

On a file with 104 lines (103 of them being "pass") and
542 bytes, the number of _IsLinebreak calls went down
from 6770 to 550
msg48668 - (view) Author: Walter Dörwald (doerwalter) Date: 2005-09-02 18:55
Logged In: YES 
user_id=89016

Is there any change that this patch gets into 2.4.2?
msg48669 - (view) Author: Martin v. Löwis (loewis) Date: 2005-09-18 08:46
Logged In: YES 
user_id=21627

Yes, I just committed it as


codecs.py 1.49
NEWS 1.1369
codecs.py 1.35.2.11
NEWS 1.1193.2.101
History
Date User Action Args
2005-08-24 14:13:50loewiscreate