top | item 44511576

(no title)

soruly | 7 months ago

I think it depends on what you're compressing. I experimented with my data full of hex text xml files. xz -6 is both faster and smaller than zstd -19 by about 10%. For my data, xz -2 and zstd -17 achieve the same compressed size but xz -2 is 3 times faster than zstd -17. I still use xz for archive because I rarely needs to decompress them.

discuss

order

Szpadel|7 months ago

Try combining it with --long

My use cases are usually source code, SQL dumps and log files.

Sometimes xz gave marginally better results, but difference was well below 1%

soruly|7 months ago

thanks for the tips. As my data has very low entropy, both can compress down to 3-4% of original size, but xz is a lot faster in compression.

raw size: 9612344 B

zstd --ultra -22 --long=31 => 376181 B (3.91% original, 4.088s compress, 0.013s decompress)

xz -z -9 xml => 353700 B (3.68% original, 0.729s compress, 0.032s decompress)

zstd -17 --long=31 could match the compression time of xz, but the size is bigger (405602 B, 4.22% original)

If you compare only the compressed size (not to the original size), .zst would be about 6-15% larger than .xz