You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: context recycling (reset) + dictionaries on contexts (load/ref) (#26)
* feat: add ZSTD_CCtx_reset / ZSTD_DCtx_reset context recycling
Bind ZSTD_CCtx_reset and ZSTD_DCtx_reset behind a new ZstdResetDirective
enum (SESSION_ONLY, PARAMETERS, SESSION_AND_PARAMETERS), exposed as
ZstdCompressCtx.reset(...) / ZstdDecompressCtx.reset(...). Lets a pooled
or long-lived context recycle its native state between frames without
freeing and recreating it.
A parameter reset clears the context back to defaults, so the compress
context drops its cached level back to Zstd.defaultCompressionLevel() to
stay in sync with the native state.
Document the recipe in docs/how-to.md, flip both symbols to bound in
docs/supported.md (advanced-parameter count 8 -> 10, total 55 -> 57), and
add the 0.5 changelog entry.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: load/ref dictionaries on contexts (loadDictionary / refDictionary)
Bind ZSTD_CCtx/DCtx_loadDictionary on the one-shot contexts (previously
only on streams) and the new ZSTD_CCtx_refCDict / ZSTD_DCtx_refDDict.
A sticky dictionary on a context lets compression combine a dictionary
with the advanced parameters (checksum, window log, long-distance
matching) via the compress2 path — impossible through the per-call
compress(src, dict) overloads, which route the legacy dictionary path.
refDictionary attaches a pre-digested CDict/DDict by reference (no copy,
no per-call digest), the pooled-context hot path that pairs with reset.
A parameter reset clears either.
loadDictionary takes a ZstdDictionary or a native MemorySegment
(zero-copy); refDictionary borrows the digest, so the caller keeps it
alive. Tests cover dict+checksum combine, ref-across-session-reset,
reset/null clearing, segment load, and zstd-jni interop on both frames.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments