gzip vs. zlib
2008-03-04 20:08I'm baffled. gzip does its thing by calling the zlib deflate() function, though it wraps the compressed stream differently than deflate() normally does. I have an application where I don't need gzip's extra metadata, so I wrote a small program called deflate. They should perform the same apart from a small constant overhead for gzip, but they don't. As far as I can tell the only differences are minor details of buffer handling.
$ jot 40000 | gzip -9c | wc -c 87733 $ jot 40000 | ./deflate | wc -c 86224 $ jot 20000 | sed 's/.*/print "hello, world &"/' | ./lua-5.1.2/src/luac -s -o - - | gzip -9c | wc -c 81470 $ jot 20000 | sed 's/.*/print "hello, world &"/' | ./lua-5.1.2/src/luac -s -o - - | ./deflate | wc -c 82687
Lempel-Zif and jot
Date: 2008-03-05 00:27 (UTC)for i in 1 2 3 4 5 6 7 8 9;
do
echo -n "${i} " ;
jot 40000 | gzip -${i}c | wc -c;
done
1 84206
2 69436
3 69850
4 87738
5 87578
6 87733
7 87733
8 87733
9 87733
Maybe cat /usr/share/dasher/training_english_GB.txt would be more representative.
Re: Lempel-Zif and jot
Date: 2008-03-05 11:06 (UTC)