People also tend to care about how much time they spend on compression for each incremental % of compression performance and zstd tends to be a Pareto frontier for that (at least for open source algorithms)
Unfortunately for the hoster, they either have to eat the cost of the added bandwidth from a larger file or have people complain about slow decompression.
My use cases are usually source code, SQL dumps and log files.
Sometimes xz gave marginally better results, but difference was well below 1%
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
https://www.hydrogen18.com/blog/apk-the-strangest-format.htm...
I was running "zstd --ultra --threads=0" which I assumed was asking it for the absolute maximum
I redid your experiments with rust-wasm-1.83.0-r0.apk:
size perc c.time d.time
uncompressed: 290072064 - -
gzipped original: 105255109 36.29% -
bzip2 -9: 107099379 36.92% 21.1s 11.0s
bzip3 -b511: 73539847 25.35% 28.9s 32.0s
xz --extreme -9: 71010672 24.48% 142.0s 3.1s
lzip -9: 70964413 24.46% 173.5s 5.3s
zstd --ultra -22: 48288499 16.64% 155.6s 0.4s
It's pretty clear zstd blows everything else out of the water by a huge margin. And even though compressing with zstd is slightly slower than xz in this case (by less than 10%), decompression is nearly 8x as fast, and you can probably tweak the compression level to make zstd be both faster and better than xz. uncompressed: 1512662084
xz --extreme -9: 508431572 12:47
zstd --ultra -21: 508432560 12:44
(-22 ran out of memory.) So at least by me zstd was identical to xz almost to the byte and the second. zstd --ultra -22: 494517545 14:00
Pretty minor difference.If the email data is mostly text with markup (like HTML/XML), you might want to try bzip3 too.
It's also possible that a large part of your email is actually already-compressed binary data (like PDFs and images) possibly encoded in base-64. In that case it's likely that all tools are pretty good at compressing the text and headers, but can do little to compress the attachments, which would explain why the results you get are so close.
bzip3 -b511: 580771424 8:51
I suspect your theory about compressed attachments is correct, although bzip3 isn't doing very well compared to the rest.Overall I'm still slightly biased towards using zstd as a default, in that I believe:
1. zstd will almost always be among fastest formats for decompression, which is obviously nice-to-have everything else being equal.
2. zstd can achieve a very high compression ratio, depending on tuning; rarely will zstd significantly underperform the next best option.
Overall this is a pretty good case for using zstd by default, even if in some cases it's not noticably better than other formats. In your case, xz seems to be just as good.