File Compression for Modern Computing
Compression Dictionaries
A dictionary is a file that stores the compression settings for small files. A dictionary is assembled from a group of typical small files that contain similar information, preferably over 100 files. For greatest efficiency, their combined size should be about one hundred times the size of the dictionary produced from them. If the files used are fewer or smaller in size than recommended, zstd
will display a warning but still allow the dictionary to be created (Figure 2).
To create a dictionary, use the command:
zstd --train FILES
The dictionary will be saved with the default name dictionary, and a default size of 112,640KB. To give the dictionary its own name, add the name to the train
option; for example, a dictionary called quick would be named using the option --train-quick
. You can also force the dictionary to use the most compressed files by specifying the number of files to use after the name; for example,
--train-quick=k=NUMBER OF FILES
A specific size can be added with the option --maxdict=SIZE
, and a specific ID with --dicID=NUMBER
, which makes communication with the dictionary faster than relying on the name. To use a dictionary, add the option -D FILE
to the command. Nothing in the output will indicate that the dictionary is in use.
In general, the smaller the file, the greater the improvement in compression. According to the man page, a dictionary can only increase the compression of a 64KB file by 10 percent, compared with a 500 percent improvement for a file of less than 1KB.
Benchmarking
To use zstd
to its full potential requires experimentation. To use the advanced compression options, you probably will need to research the compression algorithm. However, with the methods listed here, zstd
is sure to be efficient.
But how efficient? More particularly, how does zstd
compare with other compression tools? zstd
provides its own answer with a small selection of benchmarking options. To start, you can use the option -bLEVEL
to set the compression level to test. Alternately, you can use -bLEVEL
to indicate the start of a range of compression levels and use -eLEVEL
to indicate the end of the range (Figure 3). You can also change the default of three seconds for the length of the testing with -iSECONDS
. Of course, you can also make notes as you gain experience with zstd
.
zstd
has been released recently enough that, in many ways, it is still an expert's tool. However, although the documentation can be spotty for the advanced features, there is still enough to make zstd
an alternative tool for any level of user, especially those who want a compression tool designed for modern computing.
Infos
- zstd: https://en.wikipedia.org/wiki/Zstandard
- LZ77 algorithm: https://en.wikipedia.org/wiki/LZ77_and_LZ78
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.