Skip to content

PSA: go to /etc/makepkg.conf and replace PKGEXT='pkg.tar.xz. with PKGEXT='pkg.tar' to get faster AUR packages building and installation.

It's kind of idiotic when you think about it, to heavily compress packages only to uncompress them one second later (if you're not a package builder). Source: https://wiki.archlinux.org/index.php/Makepkg#Use_other_compression_algorithms

EDIT: thank you all for your ideas

Edited 12 Jun 2019. We only hold this version.

102 points43 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
102 · 100% up
Kind
Text
ID
bzgitj

Author

5
posts
41
comments
2
media
View profile

45 comments

Try PKGEXT='.pkg.tar.gz'. Good compression and fast.

17 points

You can also install pigz, the parallel implementation of gzip, and edit COMPRESSGZ in /etc/makepkg.conf to equal (pigz -c -f -n).

11 points

pigz can cause your system to slow down while it's active if you give it all threads (of course xz -T0 will do the same)

1 points

If this is better, why isn't it default?

5 points

xz gives better compression. It's worth it for packagers to pay the extra cpu once to save everyone out there tons of bandwidth

25 points

It's not a direct upgrade, you trade a lot of space efficiency for a bit of speed and at that point you might as well use even faster algorithms like LZO.

You might actually be better off just enabling multithreading for XZ by adding -T0 to COMPRESSXZ in /etc/makepkg.conf because gzip really isn't good by today's standards (warning: this breaks reproducibility).

Arch as a whole will hopefully soon switch to ZSTD which is better than XZ in almost every way, especially in (de-)compression speeds (like, >10x).
We just have to wait until the people in charge feel confident enough that everyone's Arch installations are updated far enough to support the switch (you wouldn't be able to easily update your installation it's older than 2018-09).

10 points

It is not better, and the default will probably be changed to zstandard soon

7 points

It is the makepkg default. Just arch sets xz as its default.

Anyway there is no better. gzip is faster, while xz generates smaller files.

6 points

Because it's not better in the universal sense. It improves build times but makes packages larger. Neither of which is better in every case.

If you have a 4TB nvme ssd for the packages I doubt you care about the size (but you also probably have some insane cpu which can do xz -e9 -T0 (or -Tx where X is the number of thereads -8 so you still have 4c/8t for the rest... I mean if you have an 2990WX..) --verbose quickly.

1 points

Or, your know, just pass it as PKGEXT='.pkg.tar' makepkg -s

EDIT: This also only assumed the resulting packages are never stored on disk...they are.

14 points

It means that AUR packages will take more storage, but I did the same to save time

14 points

If you have already FS-compression enabled, maybe it's not so bad (compress=lzo on btrfs for example). I can't actually tell how good/bad it is, because btrfs(8) is a horrible tool (if someone has an idea, I'm all ears).

8 points

Just an FYI, but zstd has been supported in btrfs for a bit now, and should provide better performance and compression than lzo.

If you want to see a compression rate, you can use https://github.com/kilobyte/compsize

For example, compsize /usr:

Processed 221692 files, 118551 regular extents (123508 refs), 135568 inline.
Type       Perc     Disk Usage   Uncompressed Referenced  
TOTAL       50%      3.6G         7.2G         7.7G       
none       100%      1.5G         1.5G         1.6G       
lzo         61%       49M          80M          81M       
zstd        36%      2.0G         5.5G         6.0G

After btrfs filesystem defragment -r -v -czstd /usr, where some data was left as lzo from my original install.

11 points

On HDD, using lzo compression would actually be faster than using no compression at all, because LZO compresses faster than HDD can write data down.

13 points

This is especially helpful when installing big third-party packages that arrive in an already-compressed form, such as IntelliJ and friends.

8 points

This is especially useful if you use a filesystem with transparent compression like BTRFS or ZFS.

7 points
unknown author

Deleted before we saved it.

3 points

What I did to speed up compression was not to disable it, but to install "pixz" (which compresses with xz in parallel) and change a line in /etc/makepkg.conf:

#COMPRESSXZ=(xz -c -z -)
COMPRESSXZ=(pixz)
2 points

just pass -T0 to xz for the same results there are no important speed differences

2 points

Huh, didn't realize xz actually supported this. Good to know, thanks!

EDIT: It seems that the difference between pixz and threaded xz is that pixz will create an index if the input file is a tar file, so it's easier to take specific files from the compressed tar file.

1 points

Depends on your CPU and bandwidth capacities

2 points
unknown author

Deleted before we saved it.

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.