1

Why isn't there any difference (output filesize) with these command lines?

Gzip stdin

The output files have same filesize even though the compression levels are different

tar ... | gzip -c -1 > ...
tar ... | gzip -c -9 > ...

xz stdin

The output files have same filesize even though the compression levels are different

tar ... | xz -c -1 > ...
tar ... | xz -c -9 > ...

Gzip

The output files have same filesize even though the compression levels are different

GZ_OPT=-1 tar -zcf ...
GZ_OPT=-9 tar -zcf ...

xz

The output files have same filesize even though the compression levels are different

XZ_OPT=-1 tar -Jcf ...
XZ_OPT=-9 tar -Jcf ...
1
  • 2
    They look quite different to me. Perhaps you can edit to explain what aspect you're interested in? Dec 25, 2015 at 19:54

1 Answer 1

4

The gzip compression level does not guarantee that higher compression levels result in smaller output. In fact the BUGS section of my man gzip notes that in some cases it can be the opposite.

For xz (and bzip2), this is even more documented, as according to the manual the numerical level controls the amount of memory used by the compressor. Using more memory is supposed to make better compression, but again this is not guaranteed.

Especially if your test data is small, having the same size output is not surprising to me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .