From 0853f8604474d7c519f4e98fd338bd57c5812006 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 13 Aug 2018 13:10:42 -0700 Subject: [PATCH] adaptive mode uses default window size of 8 MB --- programs/fileio.c | 4 ++++ programs/zstd.1.md | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index 8803fff0..b2993619 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -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) ); diff --git a/programs/zstd.1.md b/programs/zstd.1.md index 5f370186..b662758a 100644 --- a/programs/zstd.1.md +++ b/programs/zstd.1.md @@ -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`: