update fullbench for compressStream2()

makes it possible to measure scenarios such as #2314
dev
Yann Collet 2020-09-21 07:19:20 -07:00
parent 200c960f1d
commit 5618e000bd
1 changed files with 37 additions and 9 deletions

View File

@ -232,23 +232,40 @@ local_ZSTD_compressStream_freshCCtx(const void* src, size_t srcSize,
r = local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, payload);
ZSTD_freeCCtx(cctx);
return r;
}
static size_t
local_ZSTD_compress_generic_end(const void* src, size_t srcSize,
void* dst, size_t dstCapacity,
void* payload)
local_ZSTD_compress2(const void* src, size_t srcSize,
void* dst, size_t dstCapacity,
void* payload)
{
(void)payload;
return ZSTD_compress2(g_cstream, dst, dstCapacity, src, srcSize);
}
static size_t
local_ZSTD_compress_generic_continue(const void* src, size_t srcSize,
void* dst, size_t dstCapacity,
void* payload)
local_ZSTD_compressStream2_end(const void* src, size_t srcSize,
void* dst, size_t dstCapacity,
void* payload)
{
ZSTD_outBuffer buffOut;
ZSTD_inBuffer buffIn;
(void)payload;
buffOut.dst = dst;
buffOut.size = dstCapacity;
buffOut.pos = 0;
buffIn.src = src;
buffIn.size = srcSize;
buffIn.pos = 0;
ZSTD_compressStream2(g_cstream, &buffOut, &buffIn, ZSTD_e_end);
return buffOut.pos;
}
static size_t
local_ZSTD_compressStream2_continue(const void* src, size_t srcSize,
void* dst, size_t dstCapacity,
void* payload)
{
ZSTD_outBuffer buffOut;
ZSTD_inBuffer buffIn;
@ -437,11 +454,17 @@ static int benchMem(unsigned benchNb,
case 43:
benchFunction = local_ZSTD_compressStream_freshCCtx; benchName = "compressStream_freshCCtx";
break;
case 50:
benchFunction = local_ZSTD_compress2; benchName = "compress2";
break;
case 51:
benchFunction = local_ZSTD_compress_generic_continue; benchName = "compress_generic, continue";
benchFunction = local_ZSTD_compressStream2_end; benchName = "compressStream2, end";
break;
case 52:
benchFunction = local_ZSTD_compress_generic_end; benchName = "compress_generic, end";
benchFunction = local_ZSTD_compressStream2_end; benchName = "compressStream2, end & short";
break;
case 53:
benchFunction = local_ZSTD_compressStream2_continue; benchName = "compressStream2, continue";
break;
case 61:
benchFunction = local_ZSTD_compress_generic_T2_continue; benchName = "compress_generic, -T2, continue";
@ -573,6 +596,11 @@ static int benchMem(unsigned benchNb,
payload = &cparams;
break;
case 52 :
/* compressStream2, short dstCapacity */
dstBuffSize--;
break;
/* test functions */
/* convention: test functions have ID > 100 */