Nir Aides <n...@winpdb.org> added the comment:

> Thank you. Are you sure the "Shortcut common case" in readline() 
> is useful? BufferedIOBase.readline() in itself should be rather fast.

On my dataset the shortcut speeds up readline() 400% on top of the default C 
implementation. 

I can take a look to why the C implementation is slow (although it is 
documented as "slowish").

> Also, I'm not sure what happens in readline() in universal mode when 
> the chunk ends with a '\r' and there's a '\n' in the following chunk 
> (see the "ugly check" that your patch removes). Is there a test for that?

The regular pattern returns either a line chunk or a newline (sequence) but not 
both. To read a line there is therefore a minimum of two peek() calls. One for 
the line content and the last for the newline. Since the peek is called with a 
value of 2, the newline sequence \r\n should be retrieved as is. There is no 
test for that.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7610>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to