]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added ZSTD_decompressDCtx() benchmark option to fullbench 3726/head
authorYann Collet <cyan@fb.com>
Wed, 16 Aug 2023 17:43:39 +0000 (10:43 -0700)
committerYann Collet <cyan@fb.com>
Wed, 16 Aug 2023 17:43:39 +0000 (10:43 -0700)
useful to compare the difference between ZSTD_decompress
and ZSTD_decompressDCtx().

tests/fullbench.c

index 0391107b993fa9562b58b34ebd2a238b721b249f..c8f0c0af1f981076b92226dc79ae1c98c626eb2f 100644 (file)
@@ -138,7 +138,14 @@ static size_t local_ZSTD_decompress(const void* src, size_t srcSize,
     return ZSTD_decompress(dst, dstSize, buff2, g_cSize);
 }
 
-static ZSTD_DCtx* g_zdc = NULL;
+static ZSTD_DCtx* g_zdc = NULL; /* will be initialized within benchMem */
+static size_t local_ZSTD_decompressDCtx(const void* src, size_t srcSize,
+                                    void* dst, size_t dstSize,
+                                    void* buff2)
+{
+    (void)src; (void)srcSize;
+    return ZSTD_decompressDCtx(g_zdc, dst, dstSize, buff2, g_cSize);
+}
 
 #ifndef ZSTD_DLL_IMPORT
 
@@ -452,6 +459,9 @@ static int benchMem(unsigned benchNb,
     case 3:
         benchFunction = local_ZSTD_compress_freshCCtx; benchName = "compress_freshCCtx";
         break;
+    case 4:
+        benchFunction = local_ZSTD_decompressDCtx; benchName = "decompressDCtx";
+        break;
 #ifndef ZSTD_DLL_IMPORT
     case 11:
         benchFunction = local_ZSTD_compressContinue; benchName = "compressContinue";
@@ -551,6 +561,9 @@ static int benchMem(unsigned benchNb,
     case 3:
         payload = &cparams;
         break;
+    case 4:
+        g_cSize = ZSTD_compress(dstBuff2, dstBuffSize, src, srcSize, cLevel);
+        break;
 #ifndef ZSTD_DLL_IMPORT
     case 11:
         payload = &cparams;