]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Update documentation for environment variable
authorsenhuang42 <senhuang96@fb.com>
Mon, 7 Sep 2020 22:35:46 +0000 (18:35 -0400)
committersenhuang42 <senhuang96@fb.com>
Tue, 8 Sep 2020 12:42:46 +0000 (08:42 -0400)
programs/README.md
programs/zstd.1.md

index 53706de727b75809e43e3c34cfd92373503a950a..171e110fc9079dab493a69d928c893f63cc81075 100644 (file)
@@ -204,14 +204,19 @@ Benchmark arguments :
 ### Passing parameters through Environment Variables
 `ZSTD_CLEVEL` can be used to modify the default compression level of `zstd`
 (usually set to `3`) to another value between 1 and 19 (the "normal" range).
-This can be useful when `zstd` CLI is invoked in a way that doesn't allow passing arguments.
+`ZSTD_NUMTHREADS` can be used to specify number of threads that `zstd` will use during compression, which by default is `1`.
+This functionality only exists when `zstd` is compiled with multithread support.
+The max # of threads is capped at: `ZSTDMT_NBWORKERS_MAX==200`.
+
+This functionality can be useful when `zstd` CLI is invoked in a way that doesn't allow passing arguments.
 One such scenario is `tar --zstd`.
-As `ZSTD_CLEVEL` only replaces the default compression level,
-it can then be overridden by corresponding command line arguments.
+As `ZSTD_CLEVEL` and `ZSTD_NUMTHREADS` only replace the default compression level
+and number of threads, respectively, they can both be overridden by corresponding command line arguments:
+`-#` for compression level and `-T#` for number of threads.
 
 There is no "generic" way to pass "any kind of parameter" to `zstd` in a pass-through manner.
 Using environment variables for this purpose has security implications.
-Therefore, this avenue is intentionally restricted and only supports `ZSTD_CLEVEL`.
+Therefore, this avenue is intentionally restricted and only supports `ZSTD_CLEVEL` and `ZSTD_NUMTHREADS`.
 
 ### Long distance matching mode
 The long distance matching mode, enabled with `--long`, is designed to improve
index 5b90b2df08e660f9f1a6ef23743437e76529d751..790383b70e986c25a1254ba7bea8774858711e9b 100644 (file)
@@ -270,11 +270,20 @@ the last one takes effect.
 
 Using environment variables to set parameters has security implications.
 Therefore, this avenue is intentionally restricted.
-Only `ZSTD_CLEVEL` is supported currently, for setting compression level.
+Only `ZSTD_CLEVEL` and `ZSTD_NUMTHREADS` are currently supported.
+They set the compression level and number of threads to use during compression, respectively.
+
 `ZSTD_CLEVEL` can be used to set the level between 1 and 19 (the "normal" range).
 If the value of `ZSTD_CLEVEL` is not a valid integer, it will be ignored with a warning message.
 `ZSTD_CLEVEL` just replaces the default compression level (`3`).
-It can be overridden by corresponding command line arguments.
+
+`ZSTD_NUMTHREADS` can be used to set the number of threads `zstd` will attempt to use during compression.
+If the value of `ZSTD_NUMTHREADS` is not a valid unsigned integer, it will be ignored with a warning message.
+'ZSTD_NUMTHREADS` has a default value of (`1`), and is capped at ZSTDMT_NBWORKERS_MAX==200. `zstd` must be
+compiled with multithread support for this to have any effect.
+
+They can both be overridden by corresponding command line arguments:
+`-#` for compression level and `-T#` for number of compression threads. 
 
 
 DICTIONARY BUILDER