Skip to content

Switch flate2 to the zlib-rs backend - #1020

Merged
edmorley merged 1 commit into
mainfrom
edmorley/flate2-zlib-rs
Oct 2, 2026
Merged

edmorley merged 1 commit into
mainfrom
edmorley/flate2-zlib-rs

Conversation

@edmorley

@edmorley edmorley commented Oct 2, 2026

Copy link
Copy Markdown
Member

The zlib-rs backend is the fastest flate2 backend, and being pure Rust it doesn't depend on a C toolchain, so cross-compiles without issue (unlike zlib-ng). See:

The runtime_detection feature has to be enabled explicitly, since it's one of the default features disabled by default-features = false, and is required for runtime CPU feature detection (and so SIMD acceleration) in zlib-rs.

This also unblocks buildpacks that use the tar feature from switching to zlib-rs themselves, since when both features are enabled zlib takes precedence over zlib-rs.

GUS-W-24154015.

The `zlib-rs` backend is the fastest `flate2` backend, and being pure
Rust it doesn't depend on a C toolchain, so cross-compiles without
issue (unlike `zlib-ng`). See:
- https://github.com/rust-lang/flate2-rs#backends
- https://trifectatech.org/blog/zlib-rs-is-faster-than-c/

The `runtime_detection` feature has to be enabled explicitly, since
it's one of the default features disabled by `default-features = false`,
and is required for runtime CPU feature detection (and so SIMD
acceleration) in `zlib-rs`.

This also unblocks buildpacks that use the `tar` feature from switching
to `zlib-rs` themselves, since when both features are enabled `zlib`
takes precedence over `zlib-rs`.

GUS-W-24154015.
@edmorley edmorley self-assigned this Oct 2, 2026
@edmorley
edmorley marked this pull request as ready for review October 2, 2026 13:26
@edmorley
edmorley requested a review from a team as a code owner October 2, 2026 13:26
@edmorley
edmorley enabled auto-merge (squash) October 2, 2026 13:27
@edmorley
edmorley merged commit ba76e53 into main Oct 2, 2026
8 of 9 checks passed
@edmorley
edmorley deleted the edmorley/flate2-zlib-rs branch October 2, 2026 13:37
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.

2 participants