Skip to content

Commit

Permalink
benchmark more can test targetCBlockSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyan4973 committed Feb 23, 2024
1 parent 621a263 commit 68a232c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions programs/benchzstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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));
}

Expand Down
1 change: 1 addition & 0 deletions programs/benchzstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions programs/zstd.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
1 change: 1 addition & 0 deletions programs/zstdcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 68a232c

Please sign in to comment.