fixed wrong assert() condition
A single job created by ZSTDMT_compress() can be < 256KB if data to compress is < 256 KB (in which case it is delegated to single thread mode)
This commit is contained in:
parent
2cb9774f5e
commit
27e883371d
@ -475,13 +475,12 @@ size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx,
|
|||||||
size_t frameStartPos = 0, dstBufferPos = 0;
|
size_t frameStartPos = 0, dstBufferPos = 0;
|
||||||
|
|
||||||
DEBUGLOG(4, "nbChunks : %2u (chunkSize : %u bytes) ", nbChunks, (U32)avgChunkSize);
|
DEBUGLOG(4, "nbChunks : %2u (chunkSize : %u bytes) ", nbChunks, (U32)avgChunkSize);
|
||||||
assert(avgChunkSize >= 256 KB); /* required for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B) */
|
|
||||||
|
|
||||||
if (nbChunks==1) { /* fallback to single-thread mode */
|
if (nbChunks==1) { /* fallback to single-thread mode */
|
||||||
ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
|
ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
|
||||||
if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, params.fParams);
|
if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, params.fParams);
|
||||||
return ZSTD_compress_advanced(cctx, dst, dstCapacity, src, srcSize, NULL, 0, params);
|
return ZSTD_compress_advanced(cctx, dst, dstCapacity, src, srcSize, NULL, 0, params);
|
||||||
}
|
}
|
||||||
|
assert(avgChunkSize >= 256 KB); /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), which is useful to avoid allocating extra buffers */
|
||||||
|
|
||||||
if (nbChunks > mtctx->jobIDMask+1) { /* enlarge job table */
|
if (nbChunks > mtctx->jobIDMask+1) { /* enlarge job table */
|
||||||
U32 nbJobs = nbChunks;
|
U32 nbJobs = nbChunks;
|
||||||
|
@ -96,6 +96,7 @@ gzstd:
|
|||||||
fullbench32: CPPFLAGS += -m32
|
fullbench32: CPPFLAGS += -m32
|
||||||
fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP)
|
fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP)
|
||||||
fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD)
|
fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD)
|
||||||
|
fullbench fullbench32 : DEBUGFLAGS = # turn off assert() for speed measurements
|
||||||
fullbench fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c
|
fullbench fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c
|
||||||
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user