*.zst packages consistently larger than *.xz
Transition to zstd compression for packages has finished and the first packages arrived. Zstd is supposed to be faster and more efficient. However, a comparison of the "old" .xz compressed packages with the new .zst versions shows that the latter claim is not true.
A few examples from my package cache:
5.7M git-2.24.1-2-x86_64.pkg.tar.xz
5.7M git-2.24.1-3-x86_64.pkg.tar.xz
6.0M git-2.24.1-4-x86_64.pkg.tar.zst
143K libva-2.4.1-1-x86_64.pkg.tar.xz
146K libva-2.5.0-1-x86_64.pkg.tar.xz
156K libva-2.6.0-1-x86_64.pkg.tar.zst
19M llvm-libs-9.0.0-3-x86_64.pkg.tar.xz
19M llvm-libs-9.0.0-4-x86_64.pkg.tar.xz
21M llvm-libs-9.0.1-1-x86_64.pkg.tar.zst
5.7M qt5-tools-5.13.2-1-x86_64.pkg.tar.xz
5.7M qt5-tools-5.14.0-1-x86_64.pkg.tar.xz
5.9M qt5-tools-5.14.0-2-x86_64.pkg.tar.zst
160K re2-20191101-1-x86_64.pkg.tar.xz
160K re2-20191201-1-x86_64.pkg.tar.xz
177K re2-20200101-1-x86_64.pkg.tar.zst
Note that this isn't an exact comparison, as the .zst packages are different package versions. However, the net upgrade size for most packages was shown as 0.0 MiB by pacman. Also, some of the .zst versions are simply rebuilds which typically do not modify the content size of the packages.
My question is whether this 5 to 10 % increase in package size is "intended". Maybe there is an error in the compression flags? Is my methodology wrong? Are zstd compressed packages not meant to be smaller in size? Maybe anyone else is interested in looking into this?
About this post
- Posted
- Archived
- Score
- 124 · 100% up
- Kind
- Text
- ID
- eiia99
59 comments
This seems expected, check out this Arch RFC.
Thanks, that answers all my questions.
Thus, in the long run, I can expect my pacman cache to increase by 5 to 10 % (220 to 440 MiB in my case).
Just clean it, occasionally.
Requires an additional package: pacman-contrib
Interesting, what causes the checksum difference? I mean what is xz doing differently if there is just one core?
The output file contains the same information, but ordered differently within. I suspect this is caused by race conditions and how they are handled, no such issues exist when using one thread.
If you get to the end of the thread the new method
zstd -c -T0 --ultra -20 -is shown to be smaller more often than not in the small selection of packages tested. Some packages shrink, some grow. I can't say how this works out for a typical install but I wouldn't put a lot of confidence in extrapolating the 5-10% increase that was seen in OP's packages.Slightly bigger, but the tradeoff is significantly faster decompression speed.
significantly faster decompression and compression speed.
And reproducible builds. Which is quite important too IMHO.
Oh? Nice!
I never noticed an issue with decompression speed. It was always utterly dwarfed by download speed, even on the fastest internet connection. As I often use mobile data and as my laptop has a disk that isn't excessively huge I'd much prefer smaller packages to ones that decompress faster.
I don't see how this zstd change makes sense for laptop users, or even for desktop users who will still care about the size of their cache.
I have fast internet and a fast SSD, and
cudaused to get extracted quite slowly compared to the speed of downloading it. I haven’t tried again after the switch to zstd (as I am on vacation away from my Arch machine) but I would expect the 18× speedup in decompression to matter more than the 4.5% increase in size in my case.Wow, I updated my makepkg.conf:
Tried it on the
supertuxkart-git(the package contains a lot of uncompressable graphics):1m21,560s->1m58,295s0m21,478s->0m1,923s. LESS THAN TWO SECONDS FOR THE 607 MB PACKAGE! (.xz has 610 MB).Maybe recompressing
android-studiofrom a simple .deb file will finally complete within half a year with this!Keeping the default compression levels for both XZ and ZST, the packaging time of the
android-studiopackage (measured usingmakepkg -o ; time makepkg -f) on my i7-6700 machine dropped from1:39to0:25.If you’re just building packages for yourself (AUR, etc.), just set
PKGEXTto’.pkg.tar’.Well, unless you don't want to keep those packages cached in case of new-version-breakage, the uncompressed tarfiles will take up tons of disk space.
alright I'm sold. That's pretty crazy.
Anybody know if I can teach GNOME's "Archive Manager" (
file-roller) how to open a.tar.zstfile?Doesn't look like it https://gitlab.gnome.org/GNOME/file-roller/issues/41
Edit: although there does seem to be something in the source code for zstd: https://gitlab.gnome.org/GNOME/file-roller/blob/2cc70443ff913f5bec21c95c91695499f7a62470/src/fr-archive-libarchive.c#L94
Deleted before we saved it.
I dug a little deeper. It seems that zstandard support will be released in the next version: https://gitlab.gnome.org/GNOME/file-roller/commit/1866552d3e074d9a22ce3bc6fe08ea7ac96b6795 So if you want support for zstandard now you can install
file-roller-gitfrom the AUR or change the repository PKGBUILD appropriately:Ah, nice! Thank you very much for taking the time to find this out for me. I don't need it right away but I can rest, assured that it's coming. :-) Again, thanks!
Isn’t that after decompression?
Yes, isn't this his point?
Oh, right, sorry. I think I brainfarted when interpreting why that was mentioned.
To be checked, but I believe it is.
You've just hit an unfortunate set of packages. I haven't benchmarked the entire set but from my tests it trades blows, in favor of zstd
Why didn't we switch to something like lz4 before? It's been around for years and it has similar characteristics to zstd such as fast decompression.
Except that the compressed size isnt near as good
lz4 HC has similar compression rates
Who's we?