What type of data is compressed more effectively by bzip2 than gzip/zlib?


I'm comparing compression functions, and I'm surprised by what I'm seing. Maybe I'm doing something wrong, but everything I've tested has been more compressed by gzip than bzip2!

I was under the impression that bzip2 was better than gzip. Can someone give an example of data that would demonstrate this? Thanks.

Jeremy Banks

Posted 2011-05-10T05:57:47.607

Reputation: 1



gzip is stream-oriented, bzip2 is block-oriented. You will need several tens of kilobytes before you see an advantage with bzip2.

Ignacio Vazquez-Abrams

Posted 2011-05-10T05:57:47.607

Reputation: 100 516

Additionally, there's also "pbzip2" (the "p" is for "parallel") which takes advantage of multiple processors (by using "pthreads") for additional performance gains: http://www.compression.ca/pbzip2/

– Randolf Richardson – 2011-05-10T06:40:32.970


One example of many - the Linux kernel source tarball. See http://tukaani.org/lzma/benchmarks.html for more.

Russell Davis

Posted 2011-05-10T05:57:47.607

Reputation: 1 124