adaptive mode uses default window size of 8 MB

dev
Yann Collet 2018-08-13 13:10:42 -07:00
parent 33f7709c71
commit 0853f86044
2 changed files with 7 additions and 2 deletions

View File

@ -71,6 +71,7 @@
#define MB *(1<<20)
#define GB *(1U<<30)
#define ADAPT_WINDOWLOG_DEFAULT 23 /* 8 MB */
#define DICTSIZE_MAX (32 MB) /* protection against large input (attack scenario) */
#define FNSPACE 30
@ -427,6 +428,9 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
if (dictFileName && (dictBuffer==NULL))
EXM_THROW(32, "allocation error : can't create dictBuffer");
if (g_adaptiveMode && !g_ldmFlag && !comprParams.windowLog)
comprParams.windowLog = ADAPT_WINDOWLOG_DEFAULT;
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_contentSizeFlag, 1) ); /* always enable content size when available (note: supposed to be default) */
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_dictIDFlag, g_dictIDFlag) );
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_checksumFlag, g_checksumFlag) );

View File

@ -136,10 +136,11 @@ the last one takes effect.
Final compressed result is slightly different from `-T1`.
* `--adapt` :
`zstd` will dynamically adapt compression level to perceived I/O conditions.
The current compression level can be observed live by using command `-v`.
Compression level adaptation can be observed live by using command `-v`.
Works with multi-threading and `--long` mode.
Does not work with `--single-thread`.
When not specified otherwise, uses a window size of 8 MB.
Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible.
Adaptation does not work with `--single-thread`.
* `-D file`:
use `file` as Dictionary to compress or decompress FILE(s)
* `--no-dictID`: