Skip to content

*.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?

124 points58 comments
Open on Reddit
About this post
Posted
Archived
Score
124 · 100% up
Kind
Text
ID
eiia99

Author

1
posts
2
comments
0
media
View profile

59 comments

This seems expected, check out this Arch RFC.

78 points

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).

27 points

Interesting, what causes the checksum difference? I mean what is xz doing differently if there is just one core?

13 points

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.

13 points

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.

10 points

Slightly bigger, but the tradeoff is significantly faster decompression speed.

56 points

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.

9 points

I never noticed an issue with decompression speed. It was always utterly dwarfed by download speed, even on the fastest internet connection.

I have fast internet and a fast SSD, and cuda used 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.

35 points

Wow, I updated my makepkg.conf:

COMPRESSXZ=(xz -c -z -T 0 -)
COMPRESSZST=(zstd -c -T0 --ultra -20 -)
# PKGEXT='.pkg.tar.xz'
PKGEXT='.pkg.tar.zst'

Tried it on the supertuxkart-git (the package contains a lot of uncompressable graphics):

  • the packaging time is little longer: 1m21,560s -> 1m58,295s
  • but the installation time made me think something is broken: 0m21,478s -> 0m1,923s. LESS THAN TWO SECONDS FOR THE 607 MB PACKAGE! (.xz has 610 MB).
39 points

Maybe recompressing android-studio from a simple .deb file will finally complete within half a year with this!

28 points

Keeping the default compression levels for both XZ and ZST, the packaging time of the android-studio package (measured using makepkg -o ; time makepkg -f) on my i7-6700 machine dropped from 1:39 to 0:25.

20 points

If you’re just building packages for yourself (AUR, etc.), just set PKGEXT to ’.pkg.tar’.

13 points

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.

8 points

Anybody know if I can teach GNOME's "Archive Manager" (file-roller) how to open a .tar.zst file?

12 points

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-git from the AUR or change the repository PKGBUILD appropriately:

pkgver=3.35.1
_commit=1866552d3e074d9a22ce3bc6fe08ea7ac96b6795  # tags/3.35.1^0
12 points

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!

1 points

However, the net upgrade size for most packages was shown as 0.0 MiB by pacman.

Isn’t that after decompression?

7 points

Yes, isn't this his point?

12 points

Oh, right, sorry. I think I brainfarted when interpreting why that was mentioned.

5 points

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

3 points

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.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.