For distributing archives over the Internet, the following things are generally a priority:
- Compression ratio (i.e., how small the compressor makes the data);
- Decompression time (CPU requirements);
- Decompression memory requirements; and
- Compatibility (how wide-spread the decompression program is)
Compression memory & CPU requirements aren't very important, because you can use a large fast machine for that, and you only have to do it once.
Compared to bzip2, xz has a better compression ratio and lower (better) decompression time. It, however—at the compression settings typically used—requires more memory to decompress[1] and is somewhat less widespread. Gzip uses less memory than either.
So, both gzip and xz format archives are posted, allowing you to pick:
- Need to decompress on a machine with very limited memory (<32 MB): gzip. Given, not very likely when talking about kernel sources.
- Need to decompress minimal tools available: gzip
- Want to save download time and/or bandwidth: xz
There isn't really a realistic combination of factors that'd get you to pick bzip2. So its being phased out.
I looked at compression comparisons in a blog post. I didn't attempt to replicate the results, and I suspect some of it has changed (mostly, I expect xz
has improved, as its the newest.)
(There are some specific scenarios where a good bzip2 implementation may be preferable to xz: bzip2 can compresses a file with lots of zeros and genome DNA sequences better than xz. Newer versions of xz now have an (optional) block mode which allows data recovery after the point of corruption and parallel compression and [in theory] decompression. Previously, only bzip2 offered these.[2] However none of these are relevant for kernel distribution)
1: In archive size, xz -3
is around bzip -9
. Then xz uses less memory to decompress. But xz -9
(as, e.g., used for Linux kernel tarballs) uses much more than bzip -9
. (And even xz -0
needs more than gzip -9
).
2: F21 System Wide Change: lbzip2 as default bzip2 implementation
xz -9
(xv -vvl
will tell you). – derobert Aug 11 '15 at 20:59xz
now supports parallel compression (and so doespixz
) andxz
archives can be made randomly accessible (so recoverable to some extent) and are when doing parallel compression. – Stéphane Chazelas Oct 25 '16 at 09:54