diff options
Diffstat (limited to 'programs/zstd.1.md')
-rw-r--r-- | programs/zstd.1.md | 93 |
1 files changed, 65 insertions, 28 deletions
diff --git a/programs/zstd.1.md b/programs/zstd.1.md index 2e2dc54f86685..c0c04698ddc2c 100644 --- a/programs/zstd.1.md +++ b/programs/zstd.1.md @@ -19,7 +19,7 @@ DESCRIPTION with command line syntax similar to `gzip (1)` and `xz (1)`. It is based on the **LZ77** family, with further FSE & huff0 entropy stages. `zstd` offers highly configurable compression speed, -with fast modes at > 200 MB/s per code, +with fast modes at > 200 MB/s per core, and strong modes nearing lzma compression ratios. It also features a very fast decoder, with speeds > 500 MB/s per core. @@ -102,6 +102,13 @@ the last one takes effect. * `-#`: `#` compression level \[1-19] (default: 3) +* `--fast[=#]`: + switch to ultra-fast compression levels. + If `=#` is not present, it defaults to `1`. + The higher the value, the faster the compression speed, + at the cost of some compression ratio. + This setting overwrites compression level if one was set previously. + Similarly, if a compression level is set after `--fast`, it overrides it. * `--ultra`: unlocks high compression levels 20+ (maximum 22), using a lot more memory. Note that decompression will also require more memory when using these levels. @@ -115,28 +122,31 @@ the last one takes effect. Note: If `windowLog` is set to larger than 27, `--long=windowLog` or `--memory=windowSize` needs to be passed to the decompressor. -* `--fast[=#]`: - switch to ultra-fast compression levels. - If `=#` is not present, it defaults to `1`. - The higher the value, the faster the compression speed, - at the cost of some compression ratio. - This setting overwrites compression level if one was set previously. - Similarly, if a compression level is set after `--fast`, it overrides it. - * `-T#`, `--threads=#`: Compress using `#` working threads (default: 1). If `#` is 0, attempt to detect and use the number of physical CPU cores. In all cases, the nb of threads is capped to ZSTDMT_NBTHREADS_MAX==200. This modifier does nothing if `zstd` is compiled without multithread support. * `--single-thread`: - Does not spawn a thread for compression, use caller thread instead. - This is the only available mode when multithread support is disabled. - In this mode, compression is serialized with I/O. + Does not spawn a thread for compression, use a single thread for both I/O and compression. + In this mode, compression is serialized with I/O, which is slightly slower. (This is different from `-T1`, which spawns 1 compression thread in parallel of I/O). - Single-thread mode also features lower memory usage. + This mode is the only one available when multithread support is disabled. + Single-thread mode features lower memory usage. + Final compressed result is slightly different from `-T1`. +* `--adapt[=min=#,max=#]` : + `zstd` will dynamically adapt compression level to perceived I/O conditions. + Compression level adaptation can be observed live by using command `-v`. + Adaptation can be constrained between supplied `min` and `max` levels. + The feature works when combined with multi-threading and `--long` mode. + It does not work with `--single-thread`. + It sets window size to 8 MB by default (can be changed manually, see `wlog`). + Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible. + _note_ : at the time of this writing, `--adapt` can remain stuck at low speed + when combined with multiple worker threads (>=2). * `-D file`: use `file` as Dictionary to compress or decompress FILE(s) -* `--nodictID`: +* `--no-dictID`: do not store dictionary ID within frame header (dictionary compression). The decoder will have to rely on implicit knowledge about which dictionary to use, it won't be able to check if it's correct. @@ -164,7 +174,8 @@ the last one takes effect. * `--format=FORMAT`: compress and decompress in other formats. If compiled with support, zstd can compress to or decompress from other compression algorithm - formats. Possibly available options are `gzip`, `xz`, `lzma`, and `lz4`. + formats. Possibly available options are `zstd`, `gzip`, `xz`, `lzma`, and `lz4`. + If no such format is provided, `zstd` is the default. * `-h`/`-H`, `--help`: display help/long help and exit * `-V`, `--version`: @@ -199,9 +210,10 @@ Compression of small files similar to the sample set will be greatly improved. (for example, 10 MB for a 100 KB dictionary). Supports multithreading if `zstd` is compiled with threading support. - Additional parameters can be specified with `--train-cover`. + Additional parameters can be specified with `--train-fastcover`. The legacy dictionary builder can be accessed with `--train-legacy`. - Equivalent to `--train-cover=d=8,steps=4`. + The cover dictionary builder can be accessed with `--train-cover`. + Equivalent to `--train-fastcover=d=8,steps=4`. * `-o file`: Dictionary saved into `file` (default name: dictionary). * `--maxdict=#`: @@ -222,11 +234,12 @@ Compression of small files similar to the sample set will be greatly improved. This compares favorably to 4 bytes default. However, it's up to the dictionary manager to not assign twice the same ID to 2 different dictionaries. -* `--train-cover[=k#,d=#,steps=#]`: +* `--train-cover[=k#,d=#,steps=#,split=#]`: Select parameters for the default dictionary builder algorithm named cover. If _d_ is not specified, then it tries _d_ = 6 and _d_ = 8. If _k_ is not specified, then it tries _steps_ values in the range [50, 2000]. If _steps_ is not specified, then the default value of 40 is used. + If _split_ is not specified or split <= 0, then the default value of 100 is used. Requires that _d_ <= _k_. Selects segments of size _k_ with highest score to put in the dictionary. @@ -236,6 +249,8 @@ Compression of small files similar to the sample set will be greatly improved. algorithm will run faster with d <= _8_. Good values for _k_ vary widely based on the input data, but a safe range is [2 * _d_, 2000]. + If _split_ is 100, all input samples are used for both training and testing + to find optimal _d_ and _k_ to build dictionary. Supports multithreading if `zstd` is compiled with threading support. Examples: @@ -248,6 +263,28 @@ Compression of small files similar to the sample set will be greatly improved. `zstd --train-cover=k=50 FILEs` + `zstd --train-cover=k=50,split=60 FILEs` + +* `--train-fastcover[=k#,d=#,f=#,steps=#,split=#,accel=#]`: + Same as cover but with extra parameters _f_ and _accel_ and different default value of split + If _split_ is not specified, then it tries _split_ = 75. + If _f_ is not specified, then it tries _f_ = 20. + Requires that 0 < _f_ < 32. + If _accel_ is not specified, then it tries _accel_ = 1. + Requires that 0 < _accel_ <= 10. + Requires that _d_ = 6 or _d_ = 8. + + _f_ is log of size of array that keeps track of frequency of subsegments of size _d_. + The subsegment is hashed to an index in the range [0,2^_f_ - 1]. + It is possible that 2 different subsegments are hashed to the same index, and they are considered as the same subsegment when computing frequency. + Using a higher _f_ reduces collision but takes longer. + + Examples: + + `zstd --train-fastcover FILEs` + + `zstd --train-fastcover=d=8,f=15,accel=2 FILEs` + * `--train-legacy[=selectivity=#]`: Use legacy dictionary builder algorithm with the given dictionary _selectivity_ (default: 9). @@ -354,14 +391,14 @@ The list of available _options_: A larger `targetLen` usually improves compression ratio but decreases compression speed. - For ZSTD\_fast, it specifies - the amount of data skipped between match sampling. + For ZSTD\_fast, it triggers ultra-fast mode when > 0. + The value represents the amount of data skipped between match sampling. Impact is reversed : a larger `targetLen` increases compression speed but decreases compression ratio. For all other strategies, this field has no impact. - The minimum _tlen_ is 1 and the maximum is 999. + The minimum _tlen_ is 0 and the maximum is 999. - `overlapLog`=_ovlog_, `ovlog`=_ovlog_: Determine `overlapSize`, amount of data reloaded from previous job. @@ -392,7 +429,7 @@ The list of available _options_: Larger/very small values usually decrease compression ratio. - The minumum _ldmslen_ is 4 and the maximum is 4096 (default: 64). + The minimum _ldmslen_ is 4 and the maximum is 4096 (default: 64). - `ldmBucketSizeLog`=_ldmblog_, `ldmblog`=_ldmblog_: Specify the size of each bucket for the hash table used for long distance @@ -416,6 +453,12 @@ The list of available _options_: The default value is `wlog - ldmhlog`. +### Example +The following parameters sets advanced compression options to something +similar to predefined level 19 for files bigger than 256 KB: + +`--zstd`=wlog=23,clog=23,hlog=22,slog=6,slen=3,tlen=48,strat=6 + ### -B#: Select the size of each compression job. This parameter is available only when multi-threading is enabled. @@ -424,12 +467,6 @@ Default value is `4 * windowSize`, which means it varies depending on compressio Note that job size must respect a minimum value which is enforced transparently. This minimum is either 1 MB, or `overlapSize`, whichever is largest. -### Example -The following parameters sets advanced compression options to those of -predefined level 19 for files bigger than 256 KB: - -`--zstd`=windowLog=23,chainLog=23,hashLog=22,searchLog=6,searchLength=3,targetLength=48,strategy=6 - BUGS ---- Report bugs at: https://github.com/facebook/zstd/issues |