[New-bugs-announce] [issue4663] Increase TextIOWrapper._CHUNK_SIZE

Antoine Pitrou report at bugs.python.org
Sun Dec 14 19:18:31 CET 2008


New submission from Antoine Pitrou <pitrou at free.fr>:

Simply bumping TextIOWrapper._CHUNK_SIZE from 128 to 1024 yields some
significant performance improvements.

./python -m timeit -s "f=open('LICENSE')" "f.seek(0)" "for line in f: pass"
 -> with 128: 6.21 msec per loop
 -> with 1024: 3.41 msec per loop

./python -m timeit -s "f=open('LICENSE')" "f.seek(0)" "while
f.read(100): pass"
 -> with 128: 4.03 msec per loop
 -> with 1024: 1.25 msec per loop

Is there any counter-indication to doing so?

----------
messages: 77814
nosy: christian.heimes, pitrou
priority: high
severity: normal
status: open
title: Increase TextIOWrapper._CHUNK_SIZE
type: performance
versions: Python 3.0

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


More information about the New-bugs-announce mailing list