Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase TextIOWrapper._CHUNK_SIZE #48913

Closed
pitrou opened this issue Dec 14, 2008 · 2 comments
Closed

Increase TextIOWrapper._CHUNK_SIZE #48913

pitrou opened this issue Dec 14, 2008 · 2 comments
Labels
performance Performance or resource usage

Comments

@pitrou
Copy link
Member

pitrou commented Dec 14, 2008

BPO 4663
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:

assignee = None
closed_at = <Date 2008-12-15.23:04:19.335>
created_at = <Date 2008-12-14.18:18:30.226>
labels = ['performance']
title = 'Increase TextIOWrapper._CHUNK_SIZE'
updated_at = <Date 2008-12-15.23:04:19.334>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2008-12-15.23:04:19.334>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2008-12-15.23:04:19.335>
closer = 'pitrou'
components = []
creation = <Date 2008-12-14.18:18:30.226>
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']

@pitrou
Copy link
Member Author

pitrou commented 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 pitrou added the performance Performance or resource usage label Dec 14, 2008
@pitrou
Copy link
Member Author

pitrou commented Dec 15, 2008

Committed in r67803, r67804.

@pitrou pitrou closed this as completed Dec 15, 2008
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

1 participant