[issue4561] Optimize new io library

David M. Beazley report at bugs.python.org
Sat Dec 6 13:30:27 CET 2008


David M. Beazley <beazley at users.sourceforge.net> added the comment:

I've done some profiling and the performance of reading line-by-line is 
considerably worse in Python 3 than in Python 2.  For example, this 
code:

for line in open("somefile.txt"):
    pass

Ran 35 times slower in Python 3.0 than Python 2.6 when I tested it on a 
big text file (100 Megabytes).   If you disable Unicode by opening the 
file in binary mode, it runs even slower.

This slowdown is really unacceptable for anyone who uses Python for 
parsing big non-Unicode text files (and I would claim that there are 
many such people).

----------
nosy: +beazley

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


More information about the Python-bugs-list mailing list