Gzip Or Bzip2?
From Bilbo
2006-06-20
Bzip2 yields marginally better compression in most cases (usually not as much better as shown below), but it suffers from an incredible performance penalty. It's about 30 times slower compressing, and about 20 times slower decompressing. Here's my test:
2355887 -rw-r--r-- 1 root wheel - 964804660 Jun 3 17:38:55 2006 httpd-access.2006.06.03 2355267 -rw-r--r-- 1 root wheel - 42381861 Jun 3 18:25:15 2006 httpd-access.2006.06.03.bz2 2355308 -rw-r--r-- 1 root wheel - 69563001 Jun 3 17:49:56 2006 httpd-access.2006.06.03.gz6 2356836 -rw-r--r-- 1 root wheel - 66544116 Jun 3 17:52:18 2006 httpd-access.2006.06.03.gz9 cat httpd-access.2006.06.03 > /dev/null 0.18s user 5.69s system 14% cpu 39.765 total cat httpd-access.2006.06.03 > httpd-access.2006.06.03.-- 0.06s user 12.13s system 8% cpu 2:15.81 total gzip < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz6 95.04s user 7.83s system 90% cpu 1:53.43 total gzip -9 < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz9 118.46s user 8.53s system 89% cpu 2:22.30 total bzip2 < httpd-access.2006.06.03 > httpd-access.2006.06.03.bz2 1921.21s user 11.13s system 97% cpu 32:56.64 total gunzip < httpd-access.2006.06.03.gz6 > /dev/null 22.93s user 0.40s system 98% cpu 23.584 total gunzip < httpd-access.2006.06.03.gz9 > /dev/null 22.65s user 0.47s system 98% cpu 23.462 total bunzip2 < httpd-access.2006.06.03.bz2 > /dev/null 191.29s user 2.23s system 98% cpu 3:15.93 total cat < httpd-access.2006.06.03 > /dev/null 0.01s user 3.68s system 36% cpu 10.022 total cat < httpd-access.2006.06.03 > httpd-access.2006.06.03.-- 0.03s user 7.94s system 12% cpu 1:04.11 total gzip < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz6 37.58s user 4.50s system 66% cpu 1:03.16 total gzip -9 < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz9 43.84s user 3.82s system 98% cpu 48.344 total bzip2 < httpd-access.2006.06.03 > httpd-access.2006.06.03.bz2 1491.79s user 6.70s system 98% cpu 25:23.53 total gunzip < httpd-access.2006.06.03.gz6 > /dev/null 6.89s user 0.20s system 99% cpu 7.142 total gunzip < httpd-access.2006.06.03.gz9 > /dev/null 6.74s user 0.23s system 99% cpu 7.011 total bunzip2 < httpd-access.2006.06.03.bz2 > /dev/null 133.00s user 1.21s system 98% cpu 2:15.98 total cat < httpd-access.2006.06.03 > /dev/null 0.03s user 3.75s system 34% cpu 10.852 total cat < httpd-access.2006.06.03 > /dev/null 0.04s user 3.48s system 99% cpu 3.538 total cat < httpd-access.2006.06.03 > /dev/null 0.03s user 3.48s system 99% cpu 3.536 total cat < httpd-access.2006.06.03 > httpd-access.2006.06.03.-- 0.03s user 7.67s system 12% cpu 59.762 total cat < httpd-access.2006.06.03 > httpd-access.2006.06.03.-- 0.06s user 7.68s system 9% cpu 1:19.01 total cat < httpd-access.2006.06.03 > httpd-access.2006.06.03.-- 0.04s user 7.64s system 9% cpu 1:18.20 total gzip < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz6 36.93s user 4.74s system 72% cpu 57.541 total gzip < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz6 36.32s user 3.76s system 98% cpu 40.568 total gzip < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz6 36.28s user 3.76s system 99% cpu 40.417 total gzip -9 < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz9 43.87s user 3.77s system 98% cpu 48.270 total gzip -9 < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz9 43.80s user 3.65s system 98% cpu 47.966 total gzip -9 < httpd-access.2006.06.03 > httpd-access.2006.06.03.gz9 43.44s user 4.10s system 98% cpu 48.174 total bzip2 < httpd-access.2006.06.03 > httpd-access.2006.06.03.bz2 1491.34s user 7.06s system 99% cpu 25:12.69 total bzip2 < httpd-access.2006.06.03 > httpd-access.2006.06.03.bz2 1491.56s user 6.62s system 98% cpu 25:13.42 total bzip2 < httpd-access.2006.06.03 > httpd-access.2006.06.03.bz2 1491.53s user 6.40s system 98% cpu 25:17.02 total gunzip < httpd-access.2006.06.03.gz6 > /dev/null 6.89s user 0.20s system 97% cpu 7.286 total gunzip < httpd-access.2006.06.03.gz6 > /dev/null 6.81s user 0.21s system 99% cpu 7.045 total gunzip < httpd-access.2006.06.03.gz6 > /dev/null 6.83s user 0.19s system 99% cpu 7.054 total gunzip < httpd-access.2006.06.03.gz9 > /dev/null 6.77s user 0.20s system 99% cpu 7.009 total gunzip < httpd-access.2006.06.03.gz9 > /dev/null 6.69s user 0.23s system 98% cpu 7.013 total gunzip < httpd-access.2006.06.03.gz9 > /dev/null 6.61s user 0.31s system 99% cpu 6.953 total bunzip2 < httpd-access.2006.06.03.bz2 > /dev/null 132.86s user 1.23s system 99% cpu 2:15.22 total bunzip2 < httpd-access.2006.06.03.bz2 > /dev/null 133.01s user 1.05s system 99% cpu 2:15.38 total bunzip2 < httpd-access.2006.06.03.bz2 > /dev/null 133.02s user 1.05s system 99% cpu 2:15.14 total