Open Artoria2e5 opened 1 year ago
cbang already links three compression libraries (zlib, libbz2, liblz4). If another library is to be added, it should be libzstd, as it renders the three currently supported algorithms (plus lzma) obsolete in a way, and in addition can be used for HTTP content-encoding.
I do not believe zstd renders LZMA obsolete, because it does not cover the "compress once but do it really well" niche enough. That niche used to be bzip2's land, but lzma now do it both faster and better. Zstd is about being fast, both ways, while being also better than before. And yes, HTTP is about being fast both ways too.
https://quixdb.github.io/squash-benchmark/#ratio-vs-decompression (I do believe the zstd times are a little broken here!)
[that said, zstd is smaller than bzip2 here too]
zstd is good overall, delivering compression similar to lz4 at low levels, equivalent to gzip and bzip2 at intermediate levels, and close to lzma at high levels. Additionally, it's a well-maintained codebase -- something to consider after the xz backdoor fiasco.
By the way, zstd
also has a -T0
option.
bzip2 is ancient. It is slow to decompress and does not provide the best compression ratio. Most projects have switched to something else; Fedora's comparison may be useful here. Since this is a new version of FAH, it might finally be time to also change the compression on the tarball.
Some timing and sizing data on fahcore-22-windows-64bit-release-0.0.20. The
-T0
inxz
enables multithreading; both single-threaded and multi-thread decomp are tested.Both zstd and xz with BCJ compresses better than bzip2 and decompresses faster. Zstd is slightly smaller but very fast (34×). Xz is significantly smaller but only ~70% faster single-threaded.
Slight issue with zstd is that it requires an pypi module python-zstandard; xz is covered by the builtin
lzma
module. Cbang, which is currently used to handle tar and bz2, also does not have zstd nor xz support in https://github.com/CauldronDevelopmentLLC/cbang/blob/master/src/cbang/iostream/CompressionFilter.h.