Skip to content

Commit

Permalink
Include LDM tables size for CCtx size estimation where relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
senhuang42 committed Oct 20, 2020
1 parent b1c7fc5 commit d28d8a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/compress/zstd_compress.c
Expand Up @@ -209,6 +209,16 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
/* should not matter, as all cParams are presumed properly defined */
ZSTD_CCtxParams_init(&cctxParams, ZSTD_CLEVEL_DEFAULT);
cctxParams.cParams = cParams;

if (cParams.strategy >= ZSTD_btopt && cParams.windowLog >= 27 && cctxParams.nbWorkers == 0) {
DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including LDM into cctx params");
cctxParams.ldmParams.enableLdm = 1;
/* LDM is enabled by default for optimal parser and window size >= 128MB */
ZSTD_ldm_adjustParameters(&cctxParams.ldmParams, &cParams);
assert(cctxParams.ldmParams.hashLog >= cctxParams.ldmParams.bucketSizeLog);
assert(cctxParams.ldmParams.hashRateLog < 32);
}

assert(!ZSTD_checkCParams(cParams));
return cctxParams;
}
Expand Down

0 comments on commit d28d8a1

Please sign in to comment.