the loadDictionary method, loads the dictionary data into the CCtx, but does not bake in any parameters when loading.
when the compression process is actually started, the parameters (like compressionLevel) are then baked in for that run.
This allows the dictionary to be more flexible, but may impact startup time as the parameters are baked into the CDict.
This might not be correct, but is worth an exploration to find out why timing when using a dictionary (vs not) isn't as great as the zstd README has lead me to believe.
Switch from 'loadDictionary' to
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize, int compressionLevel);
From what I can gather (e.g. from github issues like https://github.com/facebook/zstd/pull/1555)
CDict
objectCDict
object has parameters "baked in"loadDictionary
method, loads the dictionary data into the CCtx, but does not bake in any parameters when loading.This might not be correct, but is worth an exploration to find out why timing when using a dictionary (vs not) isn't as great as the zstd README has lead me to believe.