mirror of
https://github.com/facebook/zstd.git
synced 2025-10-10 00:03:36 -04:00
Add ZSTD_DECOMPRESS_MINIMAL Macro, Which Reduces Branching of Decompress Variants
This commit is contained in:
parent
f45c9df42e
commit
df28e5babd
@ -1201,13 +1201,17 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Build Decoding Tables */
|
/* Build Decoding Tables */
|
||||||
{ int usePrefetchDecoder = dctx->ddictIsCold;
|
{
|
||||||
|
#ifndef ZSTD_DECOMPRESS_MINIMAL
|
||||||
|
int usePrefetchDecoder = dctx->ddictIsCold;
|
||||||
|
#endif
|
||||||
int nbSeq;
|
int nbSeq;
|
||||||
size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
|
size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
|
||||||
if (ZSTD_isError(seqHSize)) return seqHSize;
|
if (ZSTD_isError(seqHSize)) return seqHSize;
|
||||||
ip += seqHSize;
|
ip += seqHSize;
|
||||||
srcSize -= seqHSize;
|
srcSize -= seqHSize;
|
||||||
|
|
||||||
|
#ifndef ZSTD_DECOMPRESS_MINIMAL
|
||||||
if ( !usePrefetchDecoder
|
if ( !usePrefetchDecoder
|
||||||
&& (!frame || (dctx->fParams.windowSize > (1<<24)))
|
&& (!frame || (dctx->fParams.windowSize > (1<<24)))
|
||||||
&& (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */
|
&& (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */
|
||||||
@ -1215,11 +1219,14 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
|
|||||||
U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
|
U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
|
||||||
usePrefetchDecoder = (shareLongOffsets >= minShare);
|
usePrefetchDecoder = (shareLongOffsets >= minShare);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
dctx->ddictIsCold = 0;
|
dctx->ddictIsCold = 0;
|
||||||
|
|
||||||
|
#ifndef ZSTD_DECOMPRESS_MINIMAL
|
||||||
if (usePrefetchDecoder)
|
if (usePrefetchDecoder)
|
||||||
return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* else */
|
/* else */
|
||||||
return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user