Skip to content

fix: inflate indexed members of a one-thread compressed read across cores - #153

Merged
HaoZeke merged 2 commits into
developfrom
fix/zstd-bisect-parallel-inflate
Dec 5, 2026
Merged

HaoZeke merged 2 commits into
developfrom
fix/zstd-bisect-parallel-inflate

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

A one-thread parse of an indexed gzip or zstd file now inflates its members across cores again. The old code forced the indexed inflate onto one thread whenever a one-thread read left decode_threads unset. The parse thread count says nothing about how many cores can decompress.

With the decode budget unset, the inflate worker count also had no bound and could start one thread per member. It now stops at the available cores, matching the encoder side. Setting decode_threads=1 still keeps a one-thread read on one streaming decoder on the calling thread.

A new test pins the unset budget to the core count. It also checks that gzip and zstd files with more members than cores inflate to the same bytes as the serial path. A changelog fragment covers the fix.


Note

Medium Risk
Changes default decompression behavior and threading for one-thread compressed reads, affecting performance and memory; explicit decode_threads=1 preserves the old serial semantics.

Overview
Restores parallel inflation of indexed gzip/zstd members on one-thread CON reads when decode_threads is omitted. Serial decode on the caller is now explicit decode_threads=1 only; the old path treated a one-thread parse as serial whenever decode_threads was unset.

With decode budget 0 (unset), indexed inflate workers are capped at available_parallelism() instead of one thread per member, aligning with deflate defaults and reducing allocator oversubscription on wide files. Workers still take spans of members; output matches the serial path.

Python read_con docs/comments reflect the new budget and parse/decode threading rules (max(n_threads, decode_threads) when both are set and decode ≥ 2). A regression test pins the core cap and round-trips gzip/zstd under the default budget.

Reviewed by Cursor Bugbot for commit 4144b98. Bugbot is set up for automated code reviews on this repo. Configure here.

…ores.

A one-thread compressed read inflates indexed gzip and zstd members in parallel again.
An unset decode budget caps inflate workers at the available cores for a one-thread read, for Rust stream_frames, and for C reads.
On a one-thread compressed read, decode_threads of 1 uses one streaming decoder on the calling thread.
When decode_threads is set and at least 2, and n_threads is set, the parse count is the maximum of the two.

Kitline-Change: omzkzokzrvmswywzxxslypvkypylmkut
A one-thread compressed read leaves the decode budget at its
thread-local default of 0, which is the only path that reaches the
core cap in worker_limit_from_budget. No test held that default to
available_parallelism or confirmed it still decodes a many-member
gzip or zstd file to the exact serial plain text.

Add unset_decode_budget_caps_inflate_workers_at_available_cores,
which checks the budget stays at 0 on entry, that
worker_limit_from_budget never exceeds the core count, and that
inflate_gzip and inflate_zstd reproduce the serial plain text on a
file with more members than cores.

Kitline-Change: nglopplfhhytoxxhjyguvihjmbrhwwav
@HaoZeke
HaoZeke merged commit 5d48c39 into develop Dec 5, 2026
79 checks passed
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.

1 participant