Skip to content

streaming: expose NB_WORKERS parameter setter on ZstdCompressStream/ZstdOutputStream#85

Merged
dfa1 merged 1 commit into
mainfrom
streaming-nb-workers
Jul 18, 2026
Merged

streaming: expose NB_WORKERS parameter setter on ZstdCompressStream/ZstdOutputStream#85
dfa1 merged 1 commit into
mainfrom
streaming-nb-workers

Conversation

@dfa1

@dfa1 dfa1 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • ZstdCompressStream and ZstdOutputStream now expose parameter(ZstdCompressParameter, int), mirroring ZstdCompressContext.parameter(...) — so NB_WORKERS (plus JOB_SIZE/OVERLAP_LOG) is reachable from streaming compression, closing the gap flagged in ADR 0015 (this is the case where MT pays off most: unbounded input, no 512 KiB one-shot pledge gate). Call it right after construction, before the first compress()/write().
  • Renamed Mt* identifiers to MultiThread* for consistency with the existing ZstdMultithreadTest naming (MtCompressBenchmarkMultiThreadCompressBenchmark, Smoke.mtRoundTripmultiThreadRoundTrip, interop test names).
  • Updated ADR 0015's "Risks to manage" section to record the streaming follow-up as resolved.

Closes #82

Test plan

  • ZstdMultithreadTest — new nested round-trip tests for ZstdCompressStream and ZstdOutputStream under NB_WORKERS
  • ZstdJniInteropTest.Multithreaded — new javaMultiThreadStreamCompressJniDecompress test proving a Java MT ZstdOutputStream frame decodes in zstd-jni (the reverse direction was already covered)
  • ./mvnw -pl zstd validate (checkstyle) and javadoc:javadoc clean
  • benchmark and integration-tests modules compile after the rename

Deliberately not attempted: a non-flaky assertion on ZstdFrameProgression.activeWorkers() mid-stream — existing ZstdSegmentStreamTest.Progress already shows activeWorkers() reads 0 once a compress step completes, so any mid-stream assertion would race the worker pool draining.

ZstdCompressStream and ZstdOutputStream now expose the same
parameter(ZstdCompressParameter, int) surface as ZstdCompressContext,
so NB_WORKERS (plus JOB_SIZE/OVERLAP_LOG) is reachable from streaming
compression - previously MT was one-shot-only, even though unbounded
streaming input is where it pays off most. Set right after
construction, before the first compress()/write() call.

Also renames Mt* identifiers to MultiThread* for consistency with
ZstdMultithreadTest (MtCompressBenchmark -> MultiThreadCompressBenchmark,
Smoke.mtRoundTrip -> multiThreadRoundTrip, and the new/existing
zstd-jni interop test names).

Tests: unit round-trips for both streaming classes under NB_WORKERS,
plus a new zstd-jni interop test proving a Java MT ZstdOutputStream
frame decodes in zstd-jni (the reverse direction was already covered).

ADR 0015 updated to record the follow-up as resolved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 merged commit 88224d8 into main Jul 18, 2026
1 check passed
@dfa1
dfa1 deleted the streaming-nb-workers branch July 18, 2026 17:33
dfa1 added a commit that referenced this pull request Jul 18, 2026
…ment (#86)

docs/supported.md still said the streaming classes had no parameter
setter and that the MemorySegment-buffer driver was "remaining" -
both were stale: #82/PR #85 added parameter() to ZstdCompressStream/
ZstdOutputStream, and ZstdCompressStream/ZstdDecompressStream (the
zero-copy MemorySegment driver) have existed since b80a1d6, just
never got listed in the streaming rows or the bound-symbols table.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming parameter setter: make NB_WORKERS reachable from ZstdCompressStream/ZstdOutputStream

1 participant