Tuesday, September 17, 2013

Comparison of zip, bzip2, gzip and xz/lzma2

I ran a quick (or not so quick) test for comparing what would work best for me for compressing 751MiB of javadocs (for those not familiar - mostly html and text data).

See it here:
  19M Sep 17 16:16 jdocs.fast.xz
  22M Sep 17 14:34 jdocs.tar.bz2
  42M Sep 17 14:02 jdocs.tgz
  15M Sep 17 15:38 jdocs.xz
 203M Sep 17 14:08 jdocs.zip

Or in bytes:
 18895980 Sep 17 16:16 jdocs.fast.xz
 22483813 Sep 17 14:34 jdocs.tar.bz2
 43914931 Sep 17 14:02 jdocs.tgz
 15676572 Sep 17 15:38 jdocs.xz
211879004 Sep 17 14:08 jdocs.zip

  • for gzip, bzip2 an xz I used `tar` as a container
  • for zip, gzip and bzip2 I used -9 for compression option
  • for `xz` I used -9 -e as parameters; the fast variant had only -9
I can say  that xz uses an insane amount of memory and CPU time with the -e option so use only when size is awful important. Without -e it is at least 3 times faster.

I forgot to take `times` from each run. Sorry about that. I wanted to see how bzip2 compares with xz fast variant. My subjective judgment is that xz fast was faster.

In any case I thought somebody may find this info useful.