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
{{ message }}
Repository navigation
nostream-cli: honour NOSTREAM_XZ_THREADS once the xz binding exposes a multithreaded encoder #1205
NOSTREAM_XZ_THREADS is parsed, validated and capped in crates/nostream-cli/src/compression.rs but never reaches the encoder. XzOptions::threads is computed and then unused: xz2 0.1 exposes only xz2::write::XzEncoder::new, which is single-threaded, and has no binding for lzma_stream_encoder_mt. The module says so in the field's own doc comment, so this is a recorded shortcut rather than a silent one, and the exported stream is correct — it is just written on one thread.
Why it is not fixed here: the thread cap is not a property of the CLI, it is a property of the binding. Nothing in nostream-cli can make a single-threaded encoder use four threads, and forking the binding to expose the mt entry point is a much larger change than the cap is worth today.
What closing this means, in the order worth trying:
A binding that exposes the mt encoder.xz2 0.1 and the current lzma-sys do not. Check whether a maintained successor or a direct lzma-sys call to lzma_stream_encoder_mt is available; the latter needs its own preset/threads plumbing and an encoder wrapper.
Apply the cap where it belongs.XzOptions::threads should be passed to the encoder rather than only validated, and the module's shortcut note deleted in the same change — a note that outlives its cause reads as a design decision.
Keep the contract. Whatever the implementation, NOSTREAM_XZ_THREADS stays a positive integer, default 4, capped to available_parallelism() - 1 so one core stays with the relay, and non-positive values keep their rejection message. The Node CLI's src/utils/compression.ts is the reference for the contract, if not for the threading.
Acceptance:
An export that satisfies xz -t is produced with the encoder receiving the resolved thread count, not one thread.
The cap still resolves as documented: default 4, available_parallelism() - 1 as the ceiling, environment override honoured, invalid values rejected with the existing message.
The shortcut note in XzOptions is gone, because the condition it names no longer holds.
Output bytes remain a valid xz stream that xz -dc round-trips against the gzip path decompressed.
changed the title [-]nostream-cli: add xz compression once lzma-sys has a home[/-][+]nostream-cli: honour NOSTREAM_XZ_THREADS once the xz binding exposes a multithreaded encoder[/+]on Nov 21, 2026
Activity
[-]nostream-cli: add xz compression once lzma-sys has a home[/-][+]nostream-cli: honour NOSTREAM_XZ_THREADS once the xz binding exposes a multithreaded encoder[/+]