Merge pull request #1151 from felixhandte/zstd-dfast-in-place-dict-goto

ZSTD_dfast: Support Searching the Dictionary Context In-Place (Alternate `goto` Implementation)
This commit is contained in:
Yann Collet
2018-05-31 17:37:09 -07:00
committed by GitHub
3 changed files with 227 additions and 59 deletions
+15 -3
View File
@@ -1207,11 +1207,22 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
/* We have a choice between copying the dictionary context into the working
* context, or referencing the dictionary context from the working context
* in-place. We decide here which strategy to use. */
const int attachDict = ( pledgedSrcSize <= 8 KB
const U64 attachDictSizeCutoffs[(unsigned)ZSTD_btultra+1] = {
8 KB, /* unused */
8 KB, /* ZSTD_fast */
16 KB, /* ZSTD_dfast */
16 KB, /* ZSTD_greedy */
16 KB, /* ZSTD_lazy */
16 KB, /* ZSTD_lazy2 */
16 KB, /* ZSTD_btlazy2 */
16 KB, /* ZSTD_btopt */
16 KB /* ZSTD_btultra */
};
const int attachDict = ( pledgedSrcSize <= attachDictSizeCutoffs[cdict->cParams.strategy]
|| pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN )
&& !params.forceWindow /* dictMatchState isn't correctly
* handled in _enforceMaxDist */
&& cdict->cParams.strategy == ZSTD_fast
&& cdict->cParams.strategy <= ZSTD_dfast
&& ZSTD_equivalentCParams(cctx->appliedParams.cParams,
cdict->cParams);
@@ -2203,7 +2214,8 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_dictMo
ZSTD_compressBlock_btopt_extDict, ZSTD_compressBlock_btultra_extDict },
{ ZSTD_compressBlock_fast_dictMatchState /* default for 0 */,
ZSTD_compressBlock_fast_dictMatchState,
NULL, NULL, NULL, NULL, NULL, NULL, NULL /* unimplemented as of yet */ }
ZSTD_compressBlock_doubleFast_dictMatchState,
NULL, NULL, NULL, NULL, NULL, NULL /* unimplemented as of yet */ }
};
ZSTD_blockCompressor selectedCompressor;
ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);