[New-bugs-announce] [issue7216] low performance of zipfile readline()

Volker Siepmann report at bugs.python.org
Tue Oct 27 08:13:51 CET 2009

New submission from Volker Siepmann <newsgroups at vsiep.de>:

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

components: Library (Lib)
messages: 94545
nosy: volker_siepmann
severity: normal
status: open
title: low performance of zipfile readline()
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list