From: "David G. Andersen" Date: 2004-10-20T04:58:02+09:00 Subject: Speed gap between zcat and zlib's GzipReader I'm still in 1.8.1-land, so this may be old news, but GzipReader is (painfully) slow compared to using zcat to accomplish the same thing: The code: #!/scratch/ruby/bin/ruby require 'zlib' f = ARGV[0] s = Time.new infile = Zlib::GzipReader.new(File.new(f, "r")) #infile = IO.popen("zcat #{f}", "r") linecount = 0 infile.each_line { |l| linecount += 1 } e = Time.new print "Read #{linecount} lines in #{e - s} seconds\n" ------------------------------ Tested on: FreeBSD port-installed ruby 1.8.1 Freshly compiled 1.8.1 Freshly compiled 1.8.1 with CFLAGS=-O2 CVS version, CFLAGS=-O2 FBSD 1.8.1 1.8.1, O0 1.8.1 -O2 CVS, -O2 popen zcat: 2.3 2.3 2.3 2.3 GzipReader: 5.8 9.2 5.8 5.9 Yowza. Before I poke more, is this expected, or a known slowness issue? -Dave -- work: dga@lcs.mit.edu me: dga@pobox.com MIT Laboratory for Computer Science http://www.angio.net/