Python vs. Java gzip performance
caleb.hattingh at gmail.com
Fri Mar 17 21:04:02 CET 2006
I tried this:
from timeit import *
gzip;lines=gzip.GzipFile("gztest.txt.gz").readlines();[i+"1" for i in
lines]').timeit(200) # This is one line
# Try file object - uses buffering?
print Timer('import gzip;[i+"1" for i in
gzip.GzipFile("gztest.txt.gz")]').timeit(200) # This is one line
Doesn't seem much difference, probably because the test file easily
gets into memory, and so disk buffering has no effect. The file
"gztest.txt.gz" is a gzipped file with 1000 lines, each being "This is
a test file".
More information about the Python-list