From 354b5f1c0a78598ca760acfcb1cd3bb2c18fbae6 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Mon, 12 Oct 2020 12:20:18 -0400 Subject: [PATCH 1/3] Use cycleLog instead of chainLog to determine LDM jobLog --- lib/compress/zstdmt_compress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index baf6ef4c..0c9ae69b 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -1184,8 +1184,8 @@ static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params) if (params->ldmParams.enableLdm) { /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize - * based on chainLog instead. */ - jobLog = MAX(21, params->cParams.chainLog + 4); + * based on cycleLog instead. */ + jobLog = MAX(21, ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy) + 4); } else { jobLog = MAX(20, params->cParams.windowLog + 2); } From a39614de1f823b0038d15871d422d331b6f60236 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Tue, 13 Oct 2020 13:00:27 -0400 Subject: [PATCH 2/3] Fix incorrect usage of cycleLog() in --patch-from --- programs/fileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/fileio.c b/programs/fileio.c index 76e5cbf5..0ae549af 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -897,7 +897,7 @@ static void FIO_adjustParamsForPatchFromMode(FIO_prefs_t* const prefs, if (fileWindowLog > ZSTD_WINDOWLOG_MAX) DISPLAYLEVEL(1, "Max window log exceeded by file (compression ratio will suffer)\n"); comprParams->windowLog = MIN(ZSTD_WINDOWLOG_MAX, fileWindowLog); - if (fileWindowLog > ZSTD_cycleLog(cParams.hashLog, cParams.strategy)) { + if (fileWindowLog > ZSTD_cycleLog(cParams.chainLog, cParams.strategy)) { if (!prefs->ldmFlag) DISPLAYLEVEL(1, "long mode automatically triggered\n"); FIO_setLdmFlag(prefs, 1); From f49926edf47d8ec33834493bca0d31c6e2a90a38 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Thu, 15 Oct 2020 09:56:05 -0400 Subject: [PATCH 3/3] Change cycleLog adjustment to +3 from +4 --- lib/compress/zstdmt_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index 7f67b312..0d384c61 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -1193,7 +1193,7 @@ static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params) /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize * based on cycleLog instead. */ - jobLog = MAX(21, ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy) + 4); + jobLog = MAX(21, ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy) + 3); } else { jobLog = MAX(20, params->cParams.windowLog + 2); }