]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
adaptive mode uses default window size of 8 MB
authorYann Collet <cyan@fb.com>
Mon, 13 Aug 2018 20:10:42 +0000 (13:10 -0700)
committerYann Collet <cyan@fb.com>
Mon, 13 Aug 2018 20:13:22 +0000 (13:13 -0700)
programs/fileio.c
programs/zstd.1.md

index 8803fff0f3b7c27c7cc399e5927866dddaafd29b..b2993619141b54f8fbfb36517d716a4095da641e 100644 (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) );
index 5f37018640cf5cca8142740da9acccb4712ca72a..b662758ac901af774f83eab3b8cf1f3826674b41 100644 (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`: