]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Merge branch 'dev' into flexibleLevel 1010/head
authorYann Collet <cyan@fb.com>
Sat, 10 Feb 2018 19:54:49 +0000 (11:54 -0800)
committerYann Collet <cyan@fb.com>
Sat, 10 Feb 2018 19:54:49 +0000 (11:54 -0800)
1  2 
doc/zstd_manual.html
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_lazy.c

index 748568237bb2bb4894aab6c76ff5d98d60a3255c,1dea249d48489db85457906b0597ef98759938de..9b743c34baad9d610e6adf79b753a680c6daf52c
@@@ -800,11 -800,18 +800,13 @@@ size_t ZSTD_decodingBufferSize_min(unsi
      </b>/* multi-threading parameters */<b>
      </b>/* These parameters are only useful if multi-threading is enabled (ZSTD_MULTITHREAD).<b>
       * They return an error otherwise. */
 -    ZSTD_p_nbThreads=400,    </b>/* Select how many threads a compression job can spawn (default:1)<b>
 -                              * More threads improve speed, but also increase memory usage.
 -                              * Can only receive a value > 1 if ZSTD_MULTITHREAD is enabled.
 -                              * Special: value 0 means "do not change nbThreads" */
 -    ZSTD_p_nonBlockingMode,  </b>/* Single thread mode is by default "blocking" :<b>
 -                              * it finishes its job as much as possible, and only then gives back control to caller.
 -                              * In contrast, multi-thread is by default "non-blocking" :
 -                              * it takes some input, flush some output if available, and immediately gives back control to caller.
 -                              * Compression work is performed in parallel, within worker threads.
 -                              * (note : a strong exception to this rule is when first job is called with ZSTD_e_end : it becomes blocking)
 -                              * Setting this parameter to 1 will enforce non-blocking mode even when only 1 thread is selected.
 -                              * It allows the caller to do other tasks while the worker thread compresses in parallel. */
 +    ZSTD_p_nbWorkers=400,    </b>/* Select how many threads will be spawned to compress in parallel.<b>
-                               * Triggers asynchronous mode, even with nbWorkers = 1.
-                               * Can only be set to a value >= 1 if ZSTD_MULTITHREAD is enabled.
-                               * More threads improve speed, but also increase memory usage.
-                               * Default value is `0`, aka "blocking mode" : no worker is spawned, compression is performed inside Caller's thread */
++                              * When nbWorkers >= 1, triggers asynchronous mode :
++                              * ZSTD_compress_generic() consumes some input, flush some output if possible, and immediately gives back control to caller,
++                              * while compression work is performed in parallel, within worker threads.
++                              * (note : a strong exception to this rule is when first invocation sets ZSTD_e_end : it becomes a blocking call).
++                              * More workers improve speed, but also increase memory usage.
++                              * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
      ZSTD_p_jobSize,          </b>/* Size of a compression job. This value is only enforced in streaming (non-blocking) mode.<b>
                                * Each compression job is completed in parallel, so indirectly controls the nb of active threads.
                                * 0 means default, which is dynamically determined based on compression parameters.
  </b></pre><BR>
  <pre><b>size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);
  </b><p>  Set one compression parameter, selected by enum ZSTD_cParameter.
++  Setting a parameter is generally only possible during frame initialization (before starting compression),
++  except for a few exceptions which can be updated during compression: compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.
    Note : when `value` is an enum, cast it to unsigned for proper type checking.
--  @result : informational value (typically, the one being set, possibly corrected),
++  @result : informational value (typically, value being set clamped correctly),
              or an error code (which can be tested with ZSTD_isError()). 
  </p></pre><BR>
  
@@@ -1025,9 -1028,9 +1029,10 @@@ size_t ZSTD_CCtx_refPrefix_advanced(ZST
  <pre><b>size_t ZSTD_CCtx_setParametersUsingCCtxParams(
          ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
  </b><p>  Apply a set of ZSTD_CCtx_params to the compression context.
--  This must be done before the dictionary is loaded.
--  The pledgedSrcSize is treated as unknown.
-   Multithreading parameters are applied only if nbWorkers >= 1.
 -  Multithreading parameters are applied only if nbThreads > 1.
++  This can be done even after compression is started,
++    if nbWorkers==0, this will have no impact until a new compression is started.
++    if nbWorkers>=1, new parameters will be picked up at next job,
++       with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated).
   
  </p></pre><BR>
  
Simple merge
index 22213c225b4d107a8410342a4806b9cd8f86b1ac,35b153fa37d7ec7bbc0988f39ec18116f300e36d..9da2cbfebcb37249d2f2d582e9c68c873796ea2f
@@@ -30,9 -30,14 +30,15 @@@ extern "C" 
  /*-*************************************
  *  Constants
  ***************************************/
 -static const U32 g_searchStrength = 8;
 -#define HASH_READ_SIZE 8
 +#define kSearchStrength      8
 +#define HASH_READ_SIZE       8
 +#define ZSTD_CLEVEL_CUSTOM 999
+ #define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index 1 now means "unsorted".
+                                        It could be confused for a real successor at index "1", if sorted as larger than its predecessor.
+                                        It's not a big deal though : candidate will just be sorted again.
+                                        Additionnally, candidate position 1 will be lost.
+                                        But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss.
+                                        The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be misdhandled after table re-use with a different strategy */
  
  
  /*-*************************************
Simple merge