Skip to content

low performance of zipfile readline() #51465

Closed

Description

@volkersiepmann
BPO 7216
Nosy @amauryfa
Superseder
  • bpo-7610: Cannot use both read and readline method in same ZipExtFile object
  • 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 2010-02-09.16:08:54.961>
    created_at = <Date 2009-10-27.07:13:49.113>
    labels = ['type-bug', 'library']
    title = 'low performance of zipfile readline()'
    updated_at = <Date 2010-02-09.16:08:54.951>
    user = 'https://bugs.python.org/volkersiepmann'

    bugs.python.org fields:

    activity = <Date 2010-02-09.16:08:54.951>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-02-09.16:08:54.961>
    closer = 'amaury.forgeotdarc'
    components = ['Library (Lib)']
    creation = <Date 2009-10-27.07:13:49.113>
    creator = 'volker_siepmann'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 7216
    keywords = []
    message_count = 2.0
    messages = ['94545', '99121']
    nosy_count = 2.0
    nosy_names = ['amaury.forgeotdarc', 'volker_siepmann']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '7610'
    type = 'behavior'
    url = 'https://bugs.python.org/issue7216'
    versions = ['Python 2.6']

    Activity

    1. volkersiepmann commented on Oct 27, 2009

      volkersiepmannmannequin
      MannequinAuthor

      The readline() function in zipfile (in ZipExtFile) reads chunks of max
      100 bytes (zipfile.py, line 525) into the linebuffer. A file of 500
      MBytes therefore yields 5 million chunks.
      Changing the value 100 to 10000 bytes boosts performance by magnitudes,
      while it only requires 10k of memory.

      My fix in zipfile.py, line 525:

      buf = self.read(min(size, 10000)) # was 100 before

      Best regards / Volker Siepmann

    2. added
      stdlib
      type-bug
      on Oct 27, 2009
    3. amauryfa commented on Feb 9, 2010

      @amauryfa
      Contributor

      Already fixed with bpo-7610.

    4. 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

      stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions