]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
benchmark more can test targetCBlockSize
authorYann Collet <cyan@fb.com>
Fri, 23 Feb 2024 21:13:03 +0000 (13:13 -0800)
committerYann Collet <cyan@fb.com>
Fri, 23 Feb 2024 21:13:03 +0000 (13:13 -0800)
programs/benchzstd.c
programs/benchzstd.h
programs/zstd.1.md
programs/zstdcli.c

index 32227669f8f698e5415f53c0195fa8aac269f6b7..29ee595c174142bf519e6ef72d0ca50775c761df 100644 (file)
@@ -200,6 +200,7 @@ BMK_advancedParams_t BMK_initAdvancedParams(void)
         BMK_both,               /* mode */
         BMK_TIMETEST_DEFAULT_S, /* nbSeconds */
         0,                      /* blockSize */
+        0,               /* targetCBlockSize */
         0,                      /* nbWorkers */
         0,                      /* realTime */
         0,                      /* additionalParam */
@@ -275,6 +276,8 @@ static void BMK_initCCtx(
             (int)adv->literalCompressionMode));
     CHECK_Z(ZSTD_CCtx_setParameter(
             ctx, ZSTD_c_strategy, (int)comprParams->strategy));
+    CHECK_Z(ZSTD_CCtx_setParameter(
+            ctx, ZSTD_c_targetCBlockSize, (int)adv->targetCBlockSize));
     CHECK_Z(ZSTD_CCtx_loadDictionary(ctx, dictBuffer, dictBufferSize));
 }
 
index cdb6101c2019329fc7045505d2772e3902833b7a..ad3088cd43b1d5513d804fea3683ac77d89c4985 100644 (file)
@@ -100,6 +100,7 @@ typedef struct {
     BMK_mode_t mode;        /* 0: all, 1: compress only 2: decode only */
     unsigned nbSeconds;     /* default timing is in nbSeconds */
     size_t blockSize;       /* Maximum size of each block*/
+    size_t targetCBlockSize;/* Approximative size of compressed blocks */
     int nbWorkers;          /* multithreading */
     unsigned realTime;      /* real time priority */
     int additionalParam;    /* used by python speed benchmark */
index 231341b2a5bac625aaca7b4a13da51207e894937..9a4a5df2c6d8a1ca3fc7eaef37bd150c2a0c1f56 100644 (file)
@@ -218,6 +218,10 @@ the last one takes effect.
     expected. This feature allows for controlling the guess when needed.
     Exact guesses result in better compression ratios. Overestimates result in slightly
     degraded compression ratios, while underestimates may result in significant degradation.
+* `--target-compressed-block-size=#`:
+    Attempt to produce compressed blocks of approximately this size.
+    This will split larger blocks in order to approach this target.
+    Notably useful to improve latency when the receiver can make use of early data sooner.
 * `-o FILE`:
     save result into `FILE`.
 * `-f`, `--force`:
index dd21021b0656e0a3d00e07cb62bf75d9e1a70b7e..85d0e12d7d0a721edee07c2a631d0db9c01fd5ed 100644 (file)
@@ -1374,6 +1374,7 @@ int main(int argCount, const char* argv[])
             CLEAN_RETURN(1);
         }
         benchParams.blockSize = blockSize;
+        benchParams.targetCBlockSize = targetCBlockSize;
         benchParams.nbWorkers = (int)nbWorkers;
         benchParams.realTime = (unsigned)setRealTimePrio;
         benchParams.nbSeconds = bench_nbSeconds;