Skip to content

Increase TextIOWrapper._CHUNK_SIZE #48913

Closed

Description

@pitrou
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']

Activity

  1. pitrou commented on Dec 14, 2008

    @pitrou
    MemberAuthor

    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?

  2. pitrou commented on Dec 15, 2008

    @pitrou
    MemberAuthor

    Committed in r67803, r67804.

  3. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions