BPO | [4663](https://bugs.python.org/issue4663) --- | :--- Nosy | @pitrou, @tiran *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = created_at = labels = ['performance'] title = 'Increase TextIOWrapper._CHUNK_SIZE' updated_at = user = 'https://github.com/pitrou' ``` bugs.python.org fields: ```python activity = actor = 'pitrou' assignee = 'none' closed = True closed_date = closer = 'pitrou' components = [] creation = creator = 'pitrou' dependencies = [] files = [] hgrepos = [] issue_num = 4663 keywords = [] message_count = 2.0 messages = ['77814', '77890'] nosy_count = 2.0 nosy_names = ['pitrou', 'christian.heimes'] pr_nums = [] priority = 'high' resolution = 'fixed' stage = None status = 'closed' superseder = None type = 'performance' url = 'https://bugs.python.org/issue4663' versions = ['Python 3.0'] ```
Activity
pitrou commentedon Dec 14, 2008
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?
pitrou commentedon Dec 15, 2008
Committed in r67803, r67804.