p.fParams = f;
p.cParams = *(ZSTD_compressionParameters*)payload;
return ZSTD_compress_advanced (g_zcc, dst, dstSize, src, srcSize, NULL ,0, p);
- //return ZSTD_compress(dst, dstSize, src, srcSize, cLevel);
+}
+
+static size_t
+local_ZSTD_compress_freshCCtx(const void* src, size_t srcSize,
+ void* dst, size_t dstSize,
+ void* payload)
+{
+ ZSTD_parameters p;
+ ZSTD_frameParameters f = { 1 /* contentSizeHeader*/, 0, 0 };
+ p.fParams = f;
+ p.cParams = *(ZSTD_compressionParameters*)payload;
+ if (g_zcc != NULL) ZSTD_freeCCtx(g_zcc);
+ g_zcc = ZSTD_createCCtx();
+ assert(g_zcc != NULL);
+ { size_t const r = ZSTD_compress_advanced (g_zcc, dst, dstSize, src, srcSize, NULL ,0, p);
+ ZSTD_freeCCtx(g_zcc);
+ g_zcc = NULL;
+ return r;
+ }
}
static size_t g_cSize = 0;
case 2:
benchFunction = local_ZSTD_decompress; benchName = "decompress";
break;
+ case 3:
+ benchFunction = local_ZSTD_compress_freshCCtx; benchName = "compress_freshCCtx";
+ break;
#ifndef ZSTD_DLL_IMPORT
case 11:
benchFunction = local_ZSTD_compressContinue; benchName = "compressContinue";
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_targetLength, (int)cparams.targetLength);
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_strategy, cparams.strategy);
-
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_compressionLevel, cLevel);
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_windowLog, (int)cparams.windowLog);
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_hashLog, (int)cparams.hashLog);
case 2:
g_cSize = ZSTD_compress(dstBuff2, dstBuffSize, src, srcSize, cLevel);
break;
+ case 3:
+ payload = &cparams;
+ break;
#ifndef ZSTD_DLL_IMPORT
case 11:
payload = &cparams;