xref: /aosp_15_r20/external/zstd/programs/zstd.1.md (revision 01826a4963a0d8a59bc3812d29bdf0fb76416722)
1*01826a49SYabin Cuizstd(1) -- zstd, zstdmt, unzstd, zstdcat - Compress or decompress .zst files
2*01826a49SYabin Cui============================================================================
3*01826a49SYabin Cui
4*01826a49SYabin CuiSYNOPSIS
5*01826a49SYabin Cui--------
6*01826a49SYabin Cui
7*01826a49SYabin Cui`zstd` [<OPTIONS>] [-|<INPUT-FILE>] [-o <OUTPUT-FILE>]
8*01826a49SYabin Cui
9*01826a49SYabin Cui`zstdmt` is equivalent to `zstd -T0`
10*01826a49SYabin Cui
11*01826a49SYabin Cui`unzstd` is equivalent to `zstd -d`
12*01826a49SYabin Cui
13*01826a49SYabin Cui`zstdcat` is equivalent to `zstd -dcf`
14*01826a49SYabin Cui
15*01826a49SYabin Cui
16*01826a49SYabin CuiDESCRIPTION
17*01826a49SYabin Cui-----------
18*01826a49SYabin Cui`zstd` is a fast lossless compression algorithm and data compression tool,
19*01826a49SYabin Cuiwith command line syntax similar to `gzip`(1) and `xz`(1).
20*01826a49SYabin CuiIt is based on the **LZ77** family, with further FSE & huff0 entropy stages.
21*01826a49SYabin Cui`zstd` offers highly configurable compression speed,
22*01826a49SYabin Cuifrom fast modes at > 200 MB/s per core,
23*01826a49SYabin Cuito strong modes with excellent compression ratios.
24*01826a49SYabin CuiIt also features a very fast decoder, with speeds > 500 MB/s per core,
25*01826a49SYabin Cuiwhich remains roughly stable at all compression settings.
26*01826a49SYabin Cui
27*01826a49SYabin Cui`zstd` command line syntax is generally similar to gzip,
28*01826a49SYabin Cuibut features the following few differences:
29*01826a49SYabin Cui
30*01826a49SYabin Cui  - Source files are preserved by default.
31*01826a49SYabin Cui    It's possible to remove them automatically by using the `--rm` command.
32*01826a49SYabin Cui  - When compressing a single file, `zstd` displays progress notifications
33*01826a49SYabin Cui    and result summary by default.
34*01826a49SYabin Cui    Use `-q` to turn them off.
35*01826a49SYabin Cui  - `zstd` displays a short help page when command line is an error.
36*01826a49SYabin Cui    Use `-q` to turn it off.
37*01826a49SYabin Cui  - `zstd` does not accept input from console,
38*01826a49SYabin Cui    though it does accept `stdin` when it's not the console.
39*01826a49SYabin Cui  - `zstd` does not store the input's filename or attributes, only its contents.
40*01826a49SYabin Cui
41*01826a49SYabin Cui`zstd` processes each _file_ according to the selected operation mode.
42*01826a49SYabin CuiIf no _files_ are given or _file_ is `-`, `zstd` reads from standard input
43*01826a49SYabin Cuiand writes the processed data to standard output.
44*01826a49SYabin Cui`zstd` will refuse to write compressed data to standard output
45*01826a49SYabin Cuiif it is a terminal: it will display an error message and skip the file.
46*01826a49SYabin CuiSimilarly, `zstd` will refuse to read compressed data from standard input
47*01826a49SYabin Cuiif it is a terminal.
48*01826a49SYabin Cui
49*01826a49SYabin CuiUnless `--stdout` or `-o` is specified, _files_ are written to a new file
50*01826a49SYabin Cuiwhose name is derived from the source _file_ name:
51*01826a49SYabin Cui
52*01826a49SYabin Cui* When compressing, the suffix `.zst` is appended to the source filename to
53*01826a49SYabin Cui  get the target filename.
54*01826a49SYabin Cui* When decompressing, the `.zst` suffix is removed from the source filename to
55*01826a49SYabin Cui  get the target filename
56*01826a49SYabin Cui
57*01826a49SYabin Cui### Concatenation with .zst Files
58*01826a49SYabin CuiIt is possible to concatenate multiple `.zst` files. `zstd` will decompress
59*01826a49SYabin Cuisuch agglomerated file as if it was a single `.zst` file.
60*01826a49SYabin Cui
61*01826a49SYabin CuiOPTIONS
62*01826a49SYabin Cui-------
63*01826a49SYabin Cui
64*01826a49SYabin Cui### Integer Suffixes and Special Values
65*01826a49SYabin Cui
66*01826a49SYabin CuiIn most places where an integer argument is expected,
67*01826a49SYabin Cuian optional suffix is supported to easily indicate large integers.
68*01826a49SYabin CuiThere must be no space between the integer and the suffix.
69*01826a49SYabin Cui
70*01826a49SYabin Cui* `KiB`:
71*01826a49SYabin Cui    Multiply the integer by 1,024 (2\^10).
72*01826a49SYabin Cui    `Ki`, `K`, and `KB` are accepted as synonyms for `KiB`.
73*01826a49SYabin Cui* `MiB`:
74*01826a49SYabin Cui    Multiply the integer by 1,048,576 (2\^20).
75*01826a49SYabin Cui    `Mi`, `M`, and `MB` are accepted as synonyms for `MiB`.
76*01826a49SYabin Cui
77*01826a49SYabin Cui### Operation Mode
78*01826a49SYabin Cui
79*01826a49SYabin CuiIf multiple operation mode options are given,
80*01826a49SYabin Cuithe last one takes effect.
81*01826a49SYabin Cui
82*01826a49SYabin Cui* `-z`, `--compress`:
83*01826a49SYabin Cui    Compress.
84*01826a49SYabin Cui    This is the default operation mode when no operation mode option is specified
85*01826a49SYabin Cui    and no other operation mode is implied from the command name
86*01826a49SYabin Cui    (for example, `unzstd` implies `--decompress`).
87*01826a49SYabin Cui* `-d`, `--decompress`, `--uncompress`:
88*01826a49SYabin Cui    Decompress.
89*01826a49SYabin Cui* `-t`, `--test`:
90*01826a49SYabin Cui    Test the integrity of compressed _files_.
91*01826a49SYabin Cui    This option is equivalent to `--decompress --stdout > /dev/null`,
92*01826a49SYabin Cui    decompressed data is discarded and checksummed for errors.
93*01826a49SYabin Cui    No files are created or removed.
94*01826a49SYabin Cui* `-b#`:
95*01826a49SYabin Cui    Benchmark file(s) using compression level _#_.
96*01826a49SYabin Cui    See _BENCHMARK_ below for a description of this operation.
97*01826a49SYabin Cui* `--train FILES`:
98*01826a49SYabin Cui    Use _FILES_ as a training set to create a dictionary.
99*01826a49SYabin Cui    The training set should contain a lot of small files (> 100).
100*01826a49SYabin Cui    See _DICTIONARY BUILDER_ below for a description of this operation.
101*01826a49SYabin Cui* `-l`, `--list`:
102*01826a49SYabin Cui    Display information related to a zstd compressed file, such as size, ratio, and checksum.
103*01826a49SYabin Cui    Some of these fields may not be available.
104*01826a49SYabin Cui    This command's output can be augmented with the `-v` modifier.
105*01826a49SYabin Cui
106*01826a49SYabin Cui### Operation Modifiers
107*01826a49SYabin Cui
108*01826a49SYabin Cui* `-#`:
109*01826a49SYabin Cui    selects `#` compression level \[1-19\] (default: 3).
110*01826a49SYabin Cui    Higher compression levels *generally* produce higher compression ratio at the expense of speed and memory.
111*01826a49SYabin Cui    A rough rule of thumb is that compression speed is expected to be divided by 2 every 2 levels.
112*01826a49SYabin Cui    Technically, each level is mapped to a set of advanced parameters (that can also be modified individually, see below).
113*01826a49SYabin Cui    Because the compressor's behavior highly depends on the content to compress, there's no guarantee of a smooth progression from one level to another.
114*01826a49SYabin Cui* `--ultra`:
115*01826a49SYabin Cui    unlocks high compression levels 20+ (maximum 22), using a lot more memory.
116*01826a49SYabin Cui    Note that decompression will also require more memory when using these levels.
117*01826a49SYabin Cui* `--fast[=#]`:
118*01826a49SYabin Cui    switch to ultra-fast compression levels.
119*01826a49SYabin Cui    If `=#` is not present, it defaults to `1`.
120*01826a49SYabin Cui    The higher the value, the faster the compression speed,
121*01826a49SYabin Cui    at the cost of some compression ratio.
122*01826a49SYabin Cui    This setting overwrites compression level if one was set previously.
123*01826a49SYabin Cui    Similarly, if a compression level is set after `--fast`, it overrides it.
124*01826a49SYabin Cui* `-T#`, `--threads=#`:
125*01826a49SYabin Cui    Compress using `#` working threads (default: 1).
126*01826a49SYabin Cui    If `#` is 0, attempt to detect and use the number of physical CPU cores.
127*01826a49SYabin Cui    In all cases, the nb of threads is capped to `ZSTDMT_NBWORKERS_MAX`,
128*01826a49SYabin Cui    which is either 64 in 32-bit mode, or 256 for 64-bit environments.
129*01826a49SYabin Cui    This modifier does nothing if `zstd` is compiled without multithread support.
130*01826a49SYabin Cui* `--single-thread`:
131*01826a49SYabin Cui    Use a single thread for both I/O and compression.
132*01826a49SYabin Cui    As compression is serialized with I/O, this can be slightly slower.
133*01826a49SYabin Cui    Single-thread mode features significantly lower memory usage,
134*01826a49SYabin Cui    which can be useful for systems with limited amount of memory, such as 32-bit systems.
135*01826a49SYabin Cui
136*01826a49SYabin Cui    Note 1: this mode is the only available one when multithread support is disabled.
137*01826a49SYabin Cui
138*01826a49SYabin Cui    Note 2: this mode is different from `-T1`, which spawns 1 compression thread in parallel with I/O.
139*01826a49SYabin Cui    Final compressed result is also slightly different from `-T1`.
140*01826a49SYabin Cui* `--auto-threads={physical,logical} (default: physical)`:
141*01826a49SYabin Cui    When using a default amount of threads via `-T0`, choose the default based on the number
142*01826a49SYabin Cui    of detected physical or logical cores.
143*01826a49SYabin Cui* `--adapt[=min=#,max=#]`:
144*01826a49SYabin Cui    `zstd` will dynamically adapt compression level to perceived I/O conditions.
145*01826a49SYabin Cui    Compression level adaptation can be observed live by using command `-v`.
146*01826a49SYabin Cui    Adaptation can be constrained between supplied `min` and `max` levels.
147*01826a49SYabin Cui    The feature works when combined with multi-threading and `--long` mode.
148*01826a49SYabin Cui    It does not work with `--single-thread`.
149*01826a49SYabin Cui    It sets window size to 8 MiB by default (can be changed manually, see `wlog`).
150*01826a49SYabin Cui    Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible.
151*01826a49SYabin Cui
152*01826a49SYabin Cui    _Note_: at the time of this writing, `--adapt` can remain stuck at low speed
153*01826a49SYabin Cui    when combined with multiple worker threads (>=2).
154*01826a49SYabin Cui* `--long[=#]`:
155*01826a49SYabin Cui    enables long distance matching with `#` `windowLog`, if `#` is not
156*01826a49SYabin Cui    present it defaults to `27`.
157*01826a49SYabin Cui    This increases the window size (`windowLog`) and memory usage for both the
158*01826a49SYabin Cui    compressor and decompressor.
159*01826a49SYabin Cui    This setting is designed to improve the compression ratio for files with
160*01826a49SYabin Cui    long matches at a large distance.
161*01826a49SYabin Cui
162*01826a49SYabin Cui    Note: If `windowLog` is set to larger than 27, `--long=windowLog` or
163*01826a49SYabin Cui    `--memory=windowSize` needs to be passed to the decompressor.
164*01826a49SYabin Cui* `-D DICT`:
165*01826a49SYabin Cui    use `DICT` as Dictionary to compress or decompress FILE(s)
166*01826a49SYabin Cui* `--patch-from FILE`:
167*01826a49SYabin Cui    Specify the file to be used as a reference point for zstd's diff engine.
168*01826a49SYabin Cui    This is effectively dictionary compression with some convenient parameter
169*01826a49SYabin Cui    selection, namely that _windowSize_ > _srcSize_.
170*01826a49SYabin Cui
171*01826a49SYabin Cui    Note: cannot use both this and `-D` together.
172*01826a49SYabin Cui
173*01826a49SYabin Cui    Note: `--long` mode will be automatically activated if _chainLog_ < _fileLog_
174*01826a49SYabin Cui        (_fileLog_ being the _windowLog_ required to cover the whole file). You
175*01826a49SYabin Cui        can also manually force it.
176*01826a49SYabin Cui
177*01826a49SYabin Cui    Note: for all levels, you can use `--patch-from` in `--single-thread` mode
178*01826a49SYabin Cui        to improve compression ratio at the cost of speed.
179*01826a49SYabin Cui
180*01826a49SYabin Cui    Note: for level 19, you can get increased compression ratio at the cost
181*01826a49SYabin Cui        of speed by specifying `--zstd=targetLength=` to be something large
182*01826a49SYabin Cui        (i.e. 4096), and by setting a large `--zstd=chainLog=`.
183*01826a49SYabin Cui* `--rsyncable`:
184*01826a49SYabin Cui    `zstd` will periodically synchronize the compression state to make the
185*01826a49SYabin Cui    compressed file more rsync-friendly.
186*01826a49SYabin Cui    There is a negligible impact to compression ratio,
187*01826a49SYabin Cui    and a potential impact to compression speed, perceptible at higher speeds,
188*01826a49SYabin Cui    for example when combining `--rsyncable` with many parallel worker threads.
189*01826a49SYabin Cui    This feature does not work with `--single-thread`. You probably don't want
190*01826a49SYabin Cui    to use it with long range mode, since it will decrease the effectiveness of
191*01826a49SYabin Cui    the synchronization points, but your mileage may vary.
192*01826a49SYabin Cui* `-C`, `--[no-]check`:
193*01826a49SYabin Cui    add integrity check computed from uncompressed data (default: enabled)
194*01826a49SYabin Cui* `--[no-]content-size`:
195*01826a49SYabin Cui    enable / disable whether or not the original size of the file is placed in
196*01826a49SYabin Cui    the header of the compressed file. The default option is
197*01826a49SYabin Cui    `--content-size` (meaning that the original size will be placed in the header).
198*01826a49SYabin Cui* `--no-dictID`:
199*01826a49SYabin Cui    do not store dictionary ID within frame header (dictionary compression).
200*01826a49SYabin Cui    The decoder will have to rely on implicit knowledge about which dictionary to use,
201*01826a49SYabin Cui    it won't be able to check if it's correct.
202*01826a49SYabin Cui* `-M#`, `--memory=#`:
203*01826a49SYabin Cui    Set a memory usage limit. By default, `zstd` uses 128 MiB for decompression
204*01826a49SYabin Cui    as the maximum amount of memory the decompressor is allowed to use, but you can
205*01826a49SYabin Cui    override this manually if need be in either direction (i.e. you can increase or
206*01826a49SYabin Cui    decrease it).
207*01826a49SYabin Cui
208*01826a49SYabin Cui    This is also used during compression when using with `--patch-from=`. In this case,
209*01826a49SYabin Cui    this parameter overrides that maximum size allowed for a dictionary. (128 MiB).
210*01826a49SYabin Cui
211*01826a49SYabin Cui    Additionally, this can be used to limit memory for dictionary training. This parameter
212*01826a49SYabin Cui    overrides the default limit of 2 GiB. zstd will load training samples up to the memory limit
213*01826a49SYabin Cui    and ignore the rest.
214*01826a49SYabin Cui* `--stream-size=#`:
215*01826a49SYabin Cui    Sets the pledged source size of input coming from a stream. This value must be exact, as it
216*01826a49SYabin Cui    will be included in the produced frame header. Incorrect stream sizes will cause an error.
217*01826a49SYabin Cui    This information will be used to better optimize compression parameters, resulting in
218*01826a49SYabin Cui    better and potentially faster compression, especially for smaller source sizes.
219*01826a49SYabin Cui* `--size-hint=#`:
220*01826a49SYabin Cui    When handling input from a stream, `zstd` must guess how large the source size
221*01826a49SYabin Cui    will be when optimizing compression parameters. If the stream size is relatively
222*01826a49SYabin Cui    small, this guess may be a poor one, resulting in a higher compression ratio than
223*01826a49SYabin Cui    expected. This feature allows for controlling the guess when needed.
224*01826a49SYabin Cui    Exact guesses result in better compression ratios. Overestimates result in slightly
225*01826a49SYabin Cui    degraded compression ratios, while underestimates may result in significant degradation.
226*01826a49SYabin Cui* `--target-compressed-block-size=#`:
227*01826a49SYabin Cui    Attempt to produce compressed blocks of approximately this size.
228*01826a49SYabin Cui    This will split larger blocks in order to approach this target.
229*01826a49SYabin Cui    This feature is notably useful for improved latency, when the receiver can leverage receiving early incomplete data.
230*01826a49SYabin Cui    This parameter defines a loose target: compressed blocks will target this size "on average", but individual blocks can still be larger or smaller.
231*01826a49SYabin Cui    Enabling this feature can decrease compression speed by up to ~10% at level 1.
232*01826a49SYabin Cui    Higher levels will see smaller relative speed regression, becoming invisible at higher settings.
233*01826a49SYabin Cui* `-f`, `--force`:
234*01826a49SYabin Cui    disable input and output checks. Allows overwriting existing files, input
235*01826a49SYabin Cui    from console, output to stdout, operating on links, block devices, etc.
236*01826a49SYabin Cui    During decompression and when the output destination is stdout, pass-through
237*01826a49SYabin Cui    unrecognized formats as-is.
238*01826a49SYabin Cui* `-c`, `--stdout`:
239*01826a49SYabin Cui    write to standard output (even if it is the console); keep original files (disable `--rm`).
240*01826a49SYabin Cui* `-o FILE`:
241*01826a49SYabin Cui    save result into `FILE`.
242*01826a49SYabin Cui    Note that this operation is in conflict with `-c`.
243*01826a49SYabin Cui    If both operations are present on the command line, the last expressed one wins.
244*01826a49SYabin Cui* `--[no-]sparse`:
245*01826a49SYabin Cui    enable / disable sparse FS support,
246*01826a49SYabin Cui    to make files with many zeroes smaller on disk.
247*01826a49SYabin Cui    Creating sparse files may save disk space and speed up decompression by
248*01826a49SYabin Cui    reducing the amount of disk I/O.
249*01826a49SYabin Cui    default: enabled when output is into a file,
250*01826a49SYabin Cui    and disabled when output is stdout.
251*01826a49SYabin Cui    This setting overrides default and can force sparse mode over stdout.
252*01826a49SYabin Cui* `--[no-]pass-through`
253*01826a49SYabin Cui    enable / disable passing through uncompressed files as-is. During
254*01826a49SYabin Cui    decompression when pass-through is enabled, unrecognized formats will be
255*01826a49SYabin Cui    copied as-is from the input to the output. By default, pass-through will
256*01826a49SYabin Cui    occur when the output destination is stdout and the force (`-f`) option is
257*01826a49SYabin Cui    set.
258*01826a49SYabin Cui* `--rm`:
259*01826a49SYabin Cui    remove source file(s) after successful compression or decompression.
260*01826a49SYabin Cui    This command is silently ignored if output is `stdout`.
261*01826a49SYabin Cui    If used in combination with `-o`,
262*01826a49SYabin Cui    triggers a confirmation prompt (which can be silenced with `-f`), as this is a destructive operation.
263*01826a49SYabin Cui* `-k`, `--keep`:
264*01826a49SYabin Cui    keep source file(s) after successful compression or decompression.
265*01826a49SYabin Cui    This is the default behavior.
266*01826a49SYabin Cui* `-r`:
267*01826a49SYabin Cui    operate recursively on directories.
268*01826a49SYabin Cui    It selects all files in the named directory and all its subdirectories.
269*01826a49SYabin Cui    This can be useful both to reduce command line typing,
270*01826a49SYabin Cui    and to circumvent shell expansion limitations,
271*01826a49SYabin Cui    when there are a lot of files and naming breaks the maximum size of a command line.
272*01826a49SYabin Cui* `--filelist FILE`
273*01826a49SYabin Cui    read a list of files to process as content from `FILE`.
274*01826a49SYabin Cui    Format is compatible with `ls` output, with one file per line.
275*01826a49SYabin Cui* `--output-dir-flat DIR`:
276*01826a49SYabin Cui    resulting files are stored into target `DIR` directory,
277*01826a49SYabin Cui    instead of same directory as origin file.
278*01826a49SYabin Cui    Be aware that this command can introduce name collision issues,
279*01826a49SYabin Cui    if multiple files, from different directories, end up having the same name.
280*01826a49SYabin Cui    Collision resolution ensures first file with a given name will be present in `DIR`,
281*01826a49SYabin Cui    while in combination with `-f`, the last file will be present instead.
282*01826a49SYabin Cui* `--output-dir-mirror DIR`:
283*01826a49SYabin Cui    similar to `--output-dir-flat`,
284*01826a49SYabin Cui    the output files are stored underneath target `DIR` directory,
285*01826a49SYabin Cui    but this option will replicate input directory hierarchy into output `DIR`.
286*01826a49SYabin Cui
287*01826a49SYabin Cui    If input directory contains "..", the files in this directory will be ignored.
288*01826a49SYabin Cui    If input directory is an absolute directory (i.e. "/var/tmp/abc"),
289*01826a49SYabin Cui    it will be stored into the "output-dir/var/tmp/abc".
290*01826a49SYabin Cui    If there are multiple input files or directories,
291*01826a49SYabin Cui    name collision resolution will follow the same rules as `--output-dir-flat`.
292*01826a49SYabin Cui* `--format=FORMAT`:
293*01826a49SYabin Cui    compress and decompress in other formats. If compiled with
294*01826a49SYabin Cui    support, zstd can compress to or decompress from other compression algorithm
295*01826a49SYabin Cui    formats. Possibly available options are `zstd`, `gzip`, `xz`, `lzma`, and `lz4`.
296*01826a49SYabin Cui    If no such format is provided, `zstd` is the default.
297*01826a49SYabin Cui* `-h`/`-H`, `--help`:
298*01826a49SYabin Cui    display help/long help and exit
299*01826a49SYabin Cui* `-V`, `--version`:
300*01826a49SYabin Cui    display version number and immediately exit.
301*01826a49SYabin Cui    note that, since it exits, flags specified after `-V` are effectively ignored.
302*01826a49SYabin Cui    Advanced: `-vV` also displays supported formats.
303*01826a49SYabin Cui    `-vvV` also displays POSIX support.
304*01826a49SYabin Cui    `-qV` will only display the version number, suitable for machine reading.
305*01826a49SYabin Cui* `-v`, `--verbose`:
306*01826a49SYabin Cui    verbose mode, display more information
307*01826a49SYabin Cui* `-q`, `--quiet`:
308*01826a49SYabin Cui    suppress warnings, interactivity, and notifications.
309*01826a49SYabin Cui    specify twice to suppress errors too.
310*01826a49SYabin Cui* `--no-progress`:
311*01826a49SYabin Cui    do not display the progress bar, but keep all other messages.
312*01826a49SYabin Cui* `--show-default-cparams`:
313*01826a49SYabin Cui    shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size.
314*01826a49SYabin Cui    If the provided file is not a regular file (e.g. a pipe), this flag will output the parameters used for inputs of unknown size.
315*01826a49SYabin Cui* `--exclude-compressed`:
316*01826a49SYabin Cui    only compress files that are not already compressed.
317*01826a49SYabin Cui* `--`:
318*01826a49SYabin Cui    All arguments after `--` are treated as files
319*01826a49SYabin Cui
320*01826a49SYabin Cui
321*01826a49SYabin Cui### gzip Operation Modifiers
322*01826a49SYabin CuiWhen invoked via a `gzip` symlink, `zstd` will support further
323*01826a49SYabin Cuioptions that intend to mimic the `gzip` behavior:
324*01826a49SYabin Cui
325*01826a49SYabin Cui* `-n`, `--no-name`:
326*01826a49SYabin Cui    do not store the original filename and timestamps when compressing
327*01826a49SYabin Cui    a file. This is the default behavior and hence a no-op.
328*01826a49SYabin Cui* `--best`:
329*01826a49SYabin Cui    alias to the option `-9`.
330*01826a49SYabin Cui
331*01826a49SYabin Cui
332*01826a49SYabin Cui### Environment Variables
333*01826a49SYabin CuiEmploying environment variables to set parameters has security implications.
334*01826a49SYabin CuiTherefore, this avenue is intentionally limited.
335*01826a49SYabin CuiOnly `ZSTD_CLEVEL` and `ZSTD_NBTHREADS` are currently supported.
336*01826a49SYabin CuiThey set the default compression level and number of threads to use during compression, respectively.
337*01826a49SYabin Cui
338*01826a49SYabin Cui`ZSTD_CLEVEL` can be used to set the level between 1 and 19 (the "normal" range).
339*01826a49SYabin CuiIf the value of `ZSTD_CLEVEL` is not a valid integer, it will be ignored with a warning message.
340*01826a49SYabin Cui`ZSTD_CLEVEL` just replaces the default compression level (`3`).
341*01826a49SYabin Cui
342*01826a49SYabin Cui`ZSTD_NBTHREADS` can be used to set the number of threads `zstd` will attempt to use during compression.
343*01826a49SYabin CuiIf the value of `ZSTD_NBTHREADS` is not a valid unsigned integer, it will be ignored with a warning message.
344*01826a49SYabin Cui`ZSTD_NBTHREADS` has a default value of (`1`), and is capped at ZSTDMT_NBWORKERS_MAX==200.
345*01826a49SYabin Cui`zstd` must be compiled with multithread support for this variable to have any effect.
346*01826a49SYabin Cui
347*01826a49SYabin CuiThey can both be overridden by corresponding command line arguments:
348*01826a49SYabin Cui`-#` for compression level and `-T#` for number of compression threads.
349*01826a49SYabin Cui
350*01826a49SYabin Cui
351*01826a49SYabin CuiADVANCED COMPRESSION OPTIONS
352*01826a49SYabin Cui----------------------------
353*01826a49SYabin Cui`zstd` provides 22 predefined regular compression levels plus the fast levels.
354*01826a49SYabin CuiA compression level is translated internally into multiple advanced parameters that control the behavior of the compressor
355*01826a49SYabin Cui(one can observe the result of this translation with `--show-default-cparams`).
356*01826a49SYabin CuiThese advanced parameters can be overridden using advanced compression options.
357*01826a49SYabin Cui
358*01826a49SYabin Cui### --zstd[=options]:
359*01826a49SYabin CuiThe _options_ are provided as a comma-separated list.
360*01826a49SYabin CuiYou may specify only the options you want to change and the rest will be
361*01826a49SYabin Cuitaken from the selected or default compression level.
362*01826a49SYabin CuiThe list of available _options_:
363*01826a49SYabin Cui
364*01826a49SYabin Cui- `strategy`=_strat_, `strat`=_strat_:
365*01826a49SYabin Cui    Specify a strategy used by a match finder.
366*01826a49SYabin Cui
367*01826a49SYabin Cui    There are 9 strategies numbered from 1 to 9, from fastest to strongest:
368*01826a49SYabin Cui    1=`ZSTD_fast`, 2=`ZSTD_dfast`, 3=`ZSTD_greedy`,
369*01826a49SYabin Cui    4=`ZSTD_lazy`, 5=`ZSTD_lazy2`, 6=`ZSTD_btlazy2`,
370*01826a49SYabin Cui    7=`ZSTD_btopt`, 8=`ZSTD_btultra`, 9=`ZSTD_btultra2`.
371*01826a49SYabin Cui
372*01826a49SYabin Cui- `windowLog`=_wlog_, `wlog`=_wlog_:
373*01826a49SYabin Cui    Specify the maximum number of bits for a match distance.
374*01826a49SYabin Cui
375*01826a49SYabin Cui    The higher number of increases the chance to find a match which usually
376*01826a49SYabin Cui    improves compression ratio.
377*01826a49SYabin Cui    It also increases memory requirements for the compressor and decompressor.
378*01826a49SYabin Cui    The minimum _wlog_ is 10 (1 KiB) and the maximum is 30 (1 GiB) on 32-bit
379*01826a49SYabin Cui    platforms and 31 (2 GiB) on 64-bit platforms.
380*01826a49SYabin Cui
381*01826a49SYabin Cui    Note: If `windowLog` is set to larger than 27, `--long=windowLog` or
382*01826a49SYabin Cui    `--memory=windowSize` needs to be passed to the decompressor.
383*01826a49SYabin Cui
384*01826a49SYabin Cui- `hashLog`=_hlog_, `hlog`=_hlog_:
385*01826a49SYabin Cui    Specify the maximum number of bits for a hash table.
386*01826a49SYabin Cui
387*01826a49SYabin Cui    Bigger hash tables cause fewer collisions which usually makes compression
388*01826a49SYabin Cui    faster, but requires more memory during compression.
389*01826a49SYabin Cui
390*01826a49SYabin Cui    The minimum _hlog_ is 6 (64 entries / 256 B) and the maximum is 30 (1B entries / 4 GiB).
391*01826a49SYabin Cui
392*01826a49SYabin Cui- `chainLog`=_clog_, `clog`=_clog_:
393*01826a49SYabin Cui    Specify the maximum number of bits for the secondary search structure,
394*01826a49SYabin Cui    whose form depends on the selected `strategy`.
395*01826a49SYabin Cui
396*01826a49SYabin Cui    Higher numbers of bits increases the chance to find a match which usually
397*01826a49SYabin Cui    improves compression ratio.
398*01826a49SYabin Cui    It also slows down compression speed and increases memory requirements for
399*01826a49SYabin Cui    compression.
400*01826a49SYabin Cui    This option is ignored for the `ZSTD_fast` `strategy`, which only has the primary hash table.
401*01826a49SYabin Cui
402*01826a49SYabin Cui    The minimum _clog_ is 6 (64 entries / 256 B) and the maximum is 29 (512M entries / 2 GiB) on 32-bit platforms
403*01826a49SYabin Cui    and 30 (1B entries / 4 GiB) on 64-bit platforms.
404*01826a49SYabin Cui
405*01826a49SYabin Cui- `searchLog`=_slog_, `slog`=_slog_:
406*01826a49SYabin Cui    Specify the maximum number of searches in a hash chain or a binary tree
407*01826a49SYabin Cui    using logarithmic scale.
408*01826a49SYabin Cui
409*01826a49SYabin Cui    More searches increases the chance to find a match which usually increases
410*01826a49SYabin Cui    compression ratio but decreases compression speed.
411*01826a49SYabin Cui
412*01826a49SYabin Cui    The minimum _slog_ is 1 and the maximum is 'windowLog' - 1.
413*01826a49SYabin Cui
414*01826a49SYabin Cui- `minMatch`=_mml_, `mml`=_mml_:
415*01826a49SYabin Cui    Specify the minimum searched length of a match in a hash table.
416*01826a49SYabin Cui
417*01826a49SYabin Cui    Larger search lengths usually decrease compression ratio but improve
418*01826a49SYabin Cui    decompression speed.
419*01826a49SYabin Cui
420*01826a49SYabin Cui    The minimum _mml_ is 3 and the maximum is 7.
421*01826a49SYabin Cui
422*01826a49SYabin Cui- `targetLength`=_tlen_, `tlen`=_tlen_:
423*01826a49SYabin Cui    The impact of this field vary depending on selected strategy.
424*01826a49SYabin Cui
425*01826a49SYabin Cui    For `ZSTD_btopt`, `ZSTD_btultra` and `ZSTD_btultra2`, it specifies
426*01826a49SYabin Cui    the minimum match length that causes match finder to stop searching.
427*01826a49SYabin Cui    A larger `targetLength` usually improves compression ratio
428*01826a49SYabin Cui    but decreases compression speed.
429*01826a49SYabin Cui
430*01826a49SYabin Cui    For `ZSTD_fast`, it triggers ultra-fast mode when > 0.
431*01826a49SYabin Cui    The value represents the amount of data skipped between match sampling.
432*01826a49SYabin Cui    Impact is reversed: a larger `targetLength` increases compression speed
433*01826a49SYabin Cui    but decreases compression ratio.
434*01826a49SYabin Cui
435*01826a49SYabin Cui    For all other strategies, this field has no impact.
436*01826a49SYabin Cui
437*01826a49SYabin Cui    The minimum _tlen_ is 0 and the maximum is 128 KiB.
438*01826a49SYabin Cui
439*01826a49SYabin Cui- `overlapLog`=_ovlog_,  `ovlog`=_ovlog_:
440*01826a49SYabin Cui    Determine `overlapSize`, amount of data reloaded from previous job.
441*01826a49SYabin Cui    This parameter is only available when multithreading is enabled.
442*01826a49SYabin Cui    Reloading more data improves compression ratio, but decreases speed.
443*01826a49SYabin Cui
444*01826a49SYabin Cui    The minimum _ovlog_ is 0, and the maximum is 9.
445*01826a49SYabin Cui    1 means "no overlap", hence completely independent jobs.
446*01826a49SYabin Cui    9 means "full overlap", meaning up to `windowSize` is reloaded from previous job.
447*01826a49SYabin Cui    Reducing _ovlog_ by 1 reduces the reloaded amount by a factor 2.
448*01826a49SYabin Cui    For example, 8 means "windowSize/2", and 6 means "windowSize/8".
449*01826a49SYabin Cui    Value 0 is special and means "default": _ovlog_ is automatically determined by `zstd`.
450*01826a49SYabin Cui    In which case, _ovlog_ will range from 6 to 9, depending on selected _strat_.
451*01826a49SYabin Cui
452*01826a49SYabin Cui- `ldmHashLog`=_lhlog_, `lhlog`=_lhlog_:
453*01826a49SYabin Cui    Specify the maximum size for a hash table used for long distance matching.
454*01826a49SYabin Cui
455*01826a49SYabin Cui    This option is ignored unless long distance matching is enabled.
456*01826a49SYabin Cui
457*01826a49SYabin Cui    Bigger hash tables usually improve compression ratio at the expense of more
458*01826a49SYabin Cui    memory during compression and a decrease in compression speed.
459*01826a49SYabin Cui
460*01826a49SYabin Cui    The minimum _lhlog_ is 6 and the maximum is 30 (default: 20).
461*01826a49SYabin Cui
462*01826a49SYabin Cui- `ldmMinMatch`=_lmml_, `lmml`=_lmml_:
463*01826a49SYabin Cui    Specify the minimum searched length of a match for long distance matching.
464*01826a49SYabin Cui
465*01826a49SYabin Cui    This option is ignored unless long distance matching is enabled.
466*01826a49SYabin Cui
467*01826a49SYabin Cui    Larger/very small values usually decrease compression ratio.
468*01826a49SYabin Cui
469*01826a49SYabin Cui    The minimum _lmml_ is 4 and the maximum is 4096 (default: 64).
470*01826a49SYabin Cui
471*01826a49SYabin Cui- `ldmBucketSizeLog`=_lblog_, `lblog`=_lblog_:
472*01826a49SYabin Cui    Specify the size of each bucket for the hash table used for long distance
473*01826a49SYabin Cui    matching.
474*01826a49SYabin Cui
475*01826a49SYabin Cui    This option is ignored unless long distance matching is enabled.
476*01826a49SYabin Cui
477*01826a49SYabin Cui    Larger bucket sizes improve collision resolution but decrease compression
478*01826a49SYabin Cui    speed.
479*01826a49SYabin Cui
480*01826a49SYabin Cui    The minimum _lblog_ is 1 and the maximum is 8 (default: 3).
481*01826a49SYabin Cui
482*01826a49SYabin Cui- `ldmHashRateLog`=_lhrlog_, `lhrlog`=_lhrlog_:
483*01826a49SYabin Cui    Specify the frequency of inserting entries into the long distance matching
484*01826a49SYabin Cui    hash table.
485*01826a49SYabin Cui
486*01826a49SYabin Cui    This option is ignored unless long distance matching is enabled.
487*01826a49SYabin Cui
488*01826a49SYabin Cui    Larger values will improve compression speed. Deviating far from the
489*01826a49SYabin Cui    default value will likely result in a decrease in compression ratio.
490*01826a49SYabin Cui
491*01826a49SYabin Cui    The default value is `wlog - lhlog`.
492*01826a49SYabin Cui
493*01826a49SYabin Cui### Example
494*01826a49SYabin CuiThe following parameters sets advanced compression options to something
495*01826a49SYabin Cuisimilar to predefined level 19 for files bigger than 256 KB:
496*01826a49SYabin Cui
497*01826a49SYabin Cui`--zstd`=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6
498*01826a49SYabin Cui
499*01826a49SYabin Cui### -B#:
500*01826a49SYabin CuiSpecify the size of each compression job.
501*01826a49SYabin CuiThis parameter is only available when multi-threading is enabled.
502*01826a49SYabin CuiEach compression job is run in parallel, so this value indirectly impacts the nb of active threads.
503*01826a49SYabin CuiDefault job size varies depending on compression level (generally  `4 * windowSize`).
504*01826a49SYabin Cui`-B#` makes it possible to manually select a custom size.
505*01826a49SYabin CuiNote that job size must respect a minimum value which is enforced transparently.
506*01826a49SYabin CuiThis minimum is either 512 KB, or `overlapSize`, whichever is largest.
507*01826a49SYabin CuiDifferent job sizes will lead to non-identical compressed frames.
508*01826a49SYabin Cui
509*01826a49SYabin Cui
510*01826a49SYabin CuiDICTIONARY BUILDER
511*01826a49SYabin Cui------------------
512*01826a49SYabin Cui`zstd` offers _dictionary_ compression,
513*01826a49SYabin Cuiwhich greatly improves efficiency on small files and messages.
514*01826a49SYabin CuiIt's possible to train `zstd` with a set of samples,
515*01826a49SYabin Cuithe result of which is saved into a file called a `dictionary`.
516*01826a49SYabin CuiThen, during compression and decompression, reference the same dictionary,
517*01826a49SYabin Cuiusing command `-D dictionaryFileName`.
518*01826a49SYabin CuiCompression of small files similar to the sample set will be greatly improved.
519*01826a49SYabin Cui
520*01826a49SYabin Cui* `--train FILEs`:
521*01826a49SYabin Cui    Use FILEs as training set to create a dictionary.
522*01826a49SYabin Cui    The training set should ideally contain a lot of samples (> 100),
523*01826a49SYabin Cui    and weight typically 100x the target dictionary size
524*01826a49SYabin Cui    (for example, ~10 MB for a 100 KB dictionary).
525*01826a49SYabin Cui    `--train` can be combined with `-r` to indicate a directory rather than listing all the files,
526*01826a49SYabin Cui    which can be useful to circumvent shell expansion limits.
527*01826a49SYabin Cui
528*01826a49SYabin Cui    Since dictionary compression is mostly effective for small files,
529*01826a49SYabin Cui    the expectation is that the training set will only contain small files.
530*01826a49SYabin Cui    In the case where some samples happen to be large,
531*01826a49SYabin Cui    only the first 128 KiB of these samples will be used for training.
532*01826a49SYabin Cui
533*01826a49SYabin Cui    `--train` supports multithreading if `zstd` is compiled with threading support (default).
534*01826a49SYabin Cui    Additional advanced parameters can be specified with `--train-fastcover`.
535*01826a49SYabin Cui    The legacy dictionary builder can be accessed with `--train-legacy`.
536*01826a49SYabin Cui    The slower cover dictionary builder can be accessed with `--train-cover`.
537*01826a49SYabin Cui    Default `--train` is equivalent to `--train-fastcover=d=8,steps=4`.
538*01826a49SYabin Cui
539*01826a49SYabin Cui* `-o FILE`:
540*01826a49SYabin Cui    Dictionary saved into `FILE` (default name: dictionary).
541*01826a49SYabin Cui* `--maxdict=#`:
542*01826a49SYabin Cui    Limit dictionary to specified size (default: 112640 bytes).
543*01826a49SYabin Cui    As usual, quantities are expressed in bytes by default,
544*01826a49SYabin Cui    and it's possible to employ suffixes (like `KB` or `MB`)
545*01826a49SYabin Cui    to specify larger values.
546*01826a49SYabin Cui* `-#`:
547*01826a49SYabin Cui    Use `#` compression level during training (optional).
548*01826a49SYabin Cui    Will generate statistics more tuned for selected compression level,
549*01826a49SYabin Cui    resulting in a _small_ compression ratio improvement for this level.
550*01826a49SYabin Cui* `-B#`:
551*01826a49SYabin Cui    Split input files into blocks of size # (default: no split)
552*01826a49SYabin Cui* `-M#`, `--memory=#`:
553*01826a49SYabin Cui    Limit the amount of sample data loaded for training (default: 2 GB).
554*01826a49SYabin Cui    Note that the default (2 GB) is also the maximum.
555*01826a49SYabin Cui    This parameter can be useful in situations where the training set size
556*01826a49SYabin Cui    is not well controlled and could be potentially very large.
557*01826a49SYabin Cui    Since speed of the training process is directly correlated to
558*01826a49SYabin Cui    the size of the training sample set,
559*01826a49SYabin Cui    a smaller sample set leads to faster training.
560*01826a49SYabin Cui
561*01826a49SYabin Cui    In situations where the training set is larger than maximum memory,
562*01826a49SYabin Cui    the CLI will randomly select samples among the available ones,
563*01826a49SYabin Cui    up to the maximum allowed memory budget.
564*01826a49SYabin Cui    This is meant to improve dictionary relevance
565*01826a49SYabin Cui    by mitigating the potential impact of clustering,
566*01826a49SYabin Cui    such as selecting only files from the beginning of a list
567*01826a49SYabin Cui    sorted by modification date, or sorted by alphabetical order.
568*01826a49SYabin Cui    The randomization process is deterministic, so
569*01826a49SYabin Cui    training of the same list of files with the same parameters
570*01826a49SYabin Cui    will lead to the creation of the same dictionary.
571*01826a49SYabin Cui
572*01826a49SYabin Cui* `--dictID=#`:
573*01826a49SYabin Cui    A dictionary ID is a locally unique ID.
574*01826a49SYabin Cui    The decoder will use this value to verify it is using the right dictionary.
575*01826a49SYabin Cui    By default, zstd will create a 4-bytes random number ID.
576*01826a49SYabin Cui    It's possible to provide an explicit number ID instead.
577*01826a49SYabin Cui    It's up to the dictionary manager to not assign twice the same ID to
578*01826a49SYabin Cui    2 different dictionaries.
579*01826a49SYabin Cui    Note that short numbers have an advantage:
580*01826a49SYabin Cui    an ID < 256 will only need 1 byte in the compressed frame header,
581*01826a49SYabin Cui    and an ID < 65536 will only need 2 bytes.
582*01826a49SYabin Cui    This compares favorably to 4 bytes default.
583*01826a49SYabin Cui
584*01826a49SYabin Cui    Note that RFC8878 reserves IDs less than 32768 and greater than or equal to 2\^31, so they should not be used in public.
585*01826a49SYabin Cui
586*01826a49SYabin Cui* `--train-cover[=k#,d=#,steps=#,split=#,shrink[=#]]`:
587*01826a49SYabin Cui    Select parameters for the default dictionary builder algorithm named cover.
588*01826a49SYabin Cui    If _d_ is not specified, then it tries _d_ = 6 and _d_ = 8.
589*01826a49SYabin Cui    If _k_ is not specified, then it tries _steps_ values in the range [50, 2000].
590*01826a49SYabin Cui    If _steps_ is not specified, then the default value of 40 is used.
591*01826a49SYabin Cui    If _split_ is not specified or split <= 0, then the default value of 100 is used.
592*01826a49SYabin Cui    Requires that _d_ <= _k_.
593*01826a49SYabin Cui    If _shrink_ flag is not used, then the default value for _shrinkDict_ of 0 is used.
594*01826a49SYabin Cui    If _shrink_ is not specified, then the default value for _shrinkDictMaxRegression_ of 1 is used.
595*01826a49SYabin Cui
596*01826a49SYabin Cui    Selects segments of size _k_ with highest score to put in the dictionary.
597*01826a49SYabin Cui    The score of a segment is computed by the sum of the frequencies of all the
598*01826a49SYabin Cui    subsegments of size _d_.
599*01826a49SYabin Cui    Generally _d_ should be in the range [6, 8], occasionally up to 16, but the
600*01826a49SYabin Cui    algorithm will run faster with d <= _8_.
601*01826a49SYabin Cui    Good values for _k_ vary widely based on the input data, but a safe range is
602*01826a49SYabin Cui    [2 * _d_, 2000].
603*01826a49SYabin Cui    If _split_ is 100, all input samples are used for both training and testing
604*01826a49SYabin Cui    to find optimal _d_ and _k_ to build dictionary.
605*01826a49SYabin Cui    Supports multithreading if `zstd` is compiled with threading support.
606*01826a49SYabin Cui    Having _shrink_ enabled takes a truncated dictionary of minimum size and doubles
607*01826a49SYabin Cui    in size until compression ratio of the truncated dictionary is at most
608*01826a49SYabin Cui    _shrinkDictMaxRegression%_ worse than the compression ratio of the largest dictionary.
609*01826a49SYabin Cui
610*01826a49SYabin Cui    Examples:
611*01826a49SYabin Cui
612*01826a49SYabin Cui    `zstd --train-cover FILEs`
613*01826a49SYabin Cui
614*01826a49SYabin Cui    `zstd --train-cover=k=50,d=8 FILEs`
615*01826a49SYabin Cui
616*01826a49SYabin Cui    `zstd --train-cover=d=8,steps=500 FILEs`
617*01826a49SYabin Cui
618*01826a49SYabin Cui    `zstd --train-cover=k=50 FILEs`
619*01826a49SYabin Cui
620*01826a49SYabin Cui    `zstd --train-cover=k=50,split=60 FILEs`
621*01826a49SYabin Cui
622*01826a49SYabin Cui    `zstd --train-cover=shrink FILEs`
623*01826a49SYabin Cui
624*01826a49SYabin Cui    `zstd --train-cover=shrink=2 FILEs`
625*01826a49SYabin Cui
626*01826a49SYabin Cui* `--train-fastcover[=k#,d=#,f=#,steps=#,split=#,accel=#]`:
627*01826a49SYabin Cui    Same as cover but with extra parameters _f_ and _accel_ and different default value of split
628*01826a49SYabin Cui    If _split_ is not specified, then it tries _split_ = 75.
629*01826a49SYabin Cui    If _f_ is not specified, then it tries _f_ = 20.
630*01826a49SYabin Cui    Requires that 0 < _f_ < 32.
631*01826a49SYabin Cui    If _accel_ is not specified, then it tries _accel_ = 1.
632*01826a49SYabin Cui    Requires that 0 < _accel_ <= 10.
633*01826a49SYabin Cui    Requires that _d_ = 6 or _d_ = 8.
634*01826a49SYabin Cui
635*01826a49SYabin Cui    _f_ is log of size of array that keeps track of frequency of subsegments of size _d_.
636*01826a49SYabin Cui    The subsegment is hashed to an index in the range [0,2^_f_ - 1].
637*01826a49SYabin Cui    It is possible that 2 different subsegments are hashed to the same index, and they are considered as the same subsegment when computing frequency.
638*01826a49SYabin Cui    Using a higher _f_ reduces collision but takes longer.
639*01826a49SYabin Cui
640*01826a49SYabin Cui    Examples:
641*01826a49SYabin Cui
642*01826a49SYabin Cui    `zstd --train-fastcover FILEs`
643*01826a49SYabin Cui
644*01826a49SYabin Cui    `zstd --train-fastcover=d=8,f=15,accel=2 FILEs`
645*01826a49SYabin Cui
646*01826a49SYabin Cui* `--train-legacy[=selectivity=#]`:
647*01826a49SYabin Cui    Use legacy dictionary builder algorithm with the given dictionary
648*01826a49SYabin Cui    _selectivity_ (default: 9).
649*01826a49SYabin Cui    The smaller the _selectivity_ value, the denser the dictionary,
650*01826a49SYabin Cui    improving its efficiency but reducing its achievable maximum size.
651*01826a49SYabin Cui    `--train-legacy=s=#` is also accepted.
652*01826a49SYabin Cui
653*01826a49SYabin Cui    Examples:
654*01826a49SYabin Cui
655*01826a49SYabin Cui    `zstd --train-legacy FILEs`
656*01826a49SYabin Cui
657*01826a49SYabin Cui    `zstd --train-legacy=selectivity=8 FILEs`
658*01826a49SYabin Cui
659*01826a49SYabin Cui
660*01826a49SYabin CuiBENCHMARK
661*01826a49SYabin Cui---------
662*01826a49SYabin CuiThe `zstd` CLI provides a benchmarking mode that can be used to easily find suitable compression parameters, or alternatively to benchmark a computer's performance.
663*01826a49SYabin CuiNote that the results are highly dependent on the content being compressed.
664*01826a49SYabin Cui
665*01826a49SYabin Cui* `-b#`:
666*01826a49SYabin Cui    benchmark file(s) using compression level #
667*01826a49SYabin Cui* `-e#`:
668*01826a49SYabin Cui    benchmark file(s) using multiple compression levels, from `-b#` to `-e#` (inclusive)
669*01826a49SYabin Cui* `-d`:
670*01826a49SYabin Cui    benchmark decompression speed only (requires providing an already zstd-compressed content)
671*01826a49SYabin Cui* `-i#`:
672*01826a49SYabin Cui    minimum evaluation time, in seconds (default: 3s), benchmark mode only
673*01826a49SYabin Cui* `-B#`, `--block-size=#`:
674*01826a49SYabin Cui    cut file(s) into independent chunks of size # (default: no chunking)
675*01826a49SYabin Cui* `--priority=rt`:
676*01826a49SYabin Cui    set process priority to real-time (Windows)
677*01826a49SYabin Cui
678*01826a49SYabin Cui**Output Format:** CompressionLevel#Filename: InputSize -> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed
679*01826a49SYabin Cui
680*01826a49SYabin Cui**Methodology:** For both compression and decompression speed, the entire input is compressed/decompressed in-memory to measure speed. A run lasts at least 1 sec, so when files are small, they are compressed/decompressed several times per run, in order to improve measurement accuracy.
681*01826a49SYabin Cui
682*01826a49SYabin Cui
683*01826a49SYabin CuiSEE ALSO
684*01826a49SYabin Cui--------
685*01826a49SYabin Cui`zstdgrep`(1), `zstdless`(1), `gzip`(1), `xz`(1)
686*01826a49SYabin Cui
687*01826a49SYabin CuiThe <zstandard> format is specified in Y. Collet, "Zstandard Compression and the 'application/zstd' Media Type", https://www.ietf.org/rfc/rfc8878.txt, Internet RFC 8878 (February 2021).
688*01826a49SYabin Cui
689*01826a49SYabin CuiBUGS
690*01826a49SYabin Cui----
691*01826a49SYabin CuiReport bugs at: https://github.com/facebook/zstd/issues
692*01826a49SYabin Cui
693*01826a49SYabin CuiAUTHOR
694*01826a49SYabin Cui------
695*01826a49SYabin CuiYann Collet
696