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
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
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.