mirror of
https://github.com/facebook/zstd.git
synced 2025-12-04 00:04:23 -05:00
fixed performance regression with ZSTD_decompress() on small files
memset() was a quick fix to initialization problems, but initialize too much space (tables, buffers) which show up in decompression speed of ZSTD_decompress() since it needs to recreate DCtx at each invocation. Fixed by only initialization relevant pointers and size fields.
This commit is contained in:
parent
11ea2f7fda
commit
2e4db3e531
@ -195,11 +195,16 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
|
|||||||
|
|
||||||
dctx = (ZSTD_DCtx*)ZSTD_malloc(sizeof(ZSTD_DCtx), customMem);
|
dctx = (ZSTD_DCtx*)ZSTD_malloc(sizeof(ZSTD_DCtx), customMem);
|
||||||
if (!dctx) return NULL;
|
if (!dctx) return NULL;
|
||||||
memset(dctx, 0, sizeof(*dctx));
|
|
||||||
memcpy(&dctx->customMem, &customMem, sizeof(customMem));
|
memcpy(&dctx->customMem, &customMem, sizeof(customMem));
|
||||||
ZSTD_decompressBegin(dctx); /* cannot fail */
|
ZSTD_decompressBegin(dctx); /* cannot fail */
|
||||||
dctx->streamStage = zdss_init;
|
dctx->streamStage = zdss_init;
|
||||||
dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
|
dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
|
||||||
|
dctx->ddict = NULL;
|
||||||
|
dctx->ddictLocal = NULL;
|
||||||
|
dctx->inBuff = NULL;
|
||||||
|
dctx->outBuff = NULL;
|
||||||
|
dctx->inBuffSize = 0;
|
||||||
|
dctx->outBuffSize= 0;
|
||||||
return dctx;
|
return dctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user