]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fullbench: added streaming with fresh CCtx scenario
authorYann Collet <cyan@fb.com>
Tue, 28 May 2019 23:50:49 +0000 (16:50 -0700)
committerYann Collet <cyan@fb.com>
Tue, 28 May 2019 23:50:49 +0000 (16:50 -0700)
worst case situation, where context must be recreated every time
but without knowledge of the input size
thus sizing the context for some large input.

tests/fullbench.c

index b996fc5cd1e920dcecdec0e04e2ba757de5e12e9..3340e9b534edcb5e838495f9ca5b11333c794ebf 100644 (file)
@@ -160,6 +160,19 @@ local_ZSTD_compressStream(const void* src, size_t srcSize,
     return buffOut.pos;
 }
 
+static size_t
+local_ZSTD_compressStream_freshCCtx(const void* src, size_t srcSize,
+                          void* dst, size_t dstCapacity,
+                          void* buff2)
+{
+    ZSTD_CCtx* const cctx = ZSTD_createCCtx();
+    assert(cctx != NULL);
+
+    return local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, buff2);
+
+    ZSTD_freeCCtx(cctx);
+}
+
 static size_t
 local_ZSTD_compress_generic_end(const void* src, size_t srcSize,
                                 void* dst, size_t dstCapacity,
@@ -354,6 +367,9 @@ static int benchMem(unsigned benchNb,
     case 42:
         benchFunction = local_ZSTD_decompressStream; benchName = "decompressStream";
         break;
+    case 43:
+        benchFunction = local_ZSTD_compressStream_freshCCtx; benchName = "compressStream_freshCCtx";
+        break;
     case 51:
         benchFunction = local_ZSTD_compress_generic_continue; benchName = "compress_generic, continue";
         break;