152 is faster that 221 ? I think not ...
nas at python.ca
Tue Aug 28 15:42:06 CEST 2001
Dave Harrison wrote:
> Im writing a script that goes through and reads zipped log. So far so
> But to my surprise and mild horror 1.5.2 was clocking horrendously
> faster than 2.2.1 ....
> Whats the deal?
The readlines() method of the gzip object is much slower in 2.x.
Internally it now just calls readline() repeat repeat repeat repeat
repeat repeat repeat repeatedly. Using xreadlines() will not help since
it ends up calling readline() as well. I don't know why the gzip module
was changed in this way but I'm sure it can be made much faster. Anyone
what to submit a patch to SourceForge?
In the mean time you could use:
file = os.popen("gzip -dc filename")
More information about the Python-list