Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/flate2-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.0
Choose a base ref
...
head repository: rust-lang/flate2-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.1.1
Choose a head ref
  • 13 commits
  • 5 files changed
  • 6 contributors

Commits on Feb 27, 2025

  1. docs: Update README to promote zlib-rs

    Signed-off-by: Xuanwo <github@xuanwo.io>
    Xuanwo committed Feb 27, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e6aed50 View commit details

Commits on Feb 28, 2025

  1. Merge pull request #470 from Xuanwo/update-readme-for-zlib-rs

    docs: Update README to promote zlib-rs
    Byron authored Feb 28, 2025
    Copy the full SHA
    9428b70 View commit details
  2. Update miniz_oxide to 0.8.5

    0.8.4 has an edge case bug, see #474
    oyvindln authored Feb 28, 2025
    Copy the full SHA
    39f318b View commit details
  3. Merge pull request #475 from oyvindln/patch-1

    Update miniz_oxide to 0.8.5
    Byron authored Feb 28, 2025
    Copy the full SHA
    0abbd1c View commit details

Commits on Mar 6, 2025

  1. Remove stale CHANGELOG.md

    jayvdb committed Mar 6, 2025
    Copy the full SHA
    0b2137d View commit details

Commits on Mar 15, 2025

  1. Merge pull request #476 from jayvdb/rm-changelog

    Remove stale CHANGELOG.md
    Byron authored Mar 15, 2025
    Copy the full SHA
    c9a3efa View commit details

Commits on Apr 1, 2025

  1. More informative README on backends

    Shnatsel committed Apr 1, 2025
    Copy the full SHA
    78ca174 View commit details
  2. Rewrite outdated backend notes in lib.rs

    Shnatsel committed Apr 1, 2025
    Copy the full SHA
    a24e276 View commit details
  3. Merge pull request #480 from Shnatsel/zlib-rs-readme

    More informative README on backends
    Byron authored Apr 1, 2025
    Copy the full SHA
    6debe95 View commit details
  4. less editorializing

    Shnatsel authored Apr 1, 2025
    Copy the full SHA
    694e822 View commit details
  5. Merge pull request #481 from Shnatsel/backend-docs

    Rewrite outdated backend notes in lib.rs
    Byron authored Apr 1, 2025
    Copy the full SHA
    a79bfe4 View commit details
  6. upgrade zlib-rs to version 0.5.0

    folkertdev committed Apr 1, 2025
    Copy the full SHA
    94b36b0 View commit details

Commits on Apr 2, 2025

  1. Merge pull request #482 from folkertdev/update-zlib-rs-0.5.0

    upgrade zlib-rs to version `0.5.0`
    Byron authored Apr 2, 2025
    Copy the full SHA
    98c98c8 View commit details
Showing with 31 additions and 1,941 deletions.
  1. +0 −1,920 CHANGELOG.md
  2. +4 −4 Cargo.toml
  3. +14 −2 README.md
  4. +1 −1 src/ffi/c.rs
  5. +12 −14 src/lib.rs
1,920 changes: 0 additions & 1,920 deletions CHANGELOG.md

This file was deleted.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "flate2"
authors = ["Alex Crichton <alex@alexcrichton.com>", "Josh Triplett <josh@joshtriplett.org>"]
version = "1.1.0"
version = "1.1.1"
edition = "2018"
license = "MIT OR Apache-2.0"
readme = "README.md"
@@ -22,13 +22,13 @@ exclude = [".*"]
libz-sys = { version = "1.1.20", optional = true, default-features = false }
libz-ng-sys = { version = "1.1.16", optional = true }
# this matches the default features, but we don't want to depend on the default features staying the same
libz-rs-sys = { version = "0.4.2", optional = true, default-features = false, features = ["std", "rust-allocator"] }
libz-rs-sys = { version = "0.5.0", optional = true, default-features = false, features = ["std", "rust-allocator"] }
cloudflare-zlib-sys = { version = "0.3.5", optional = true }
miniz_oxide = { version = "0.8.4", optional = true, default-features = false, features = ["with-alloc"] }
miniz_oxide = { version = "0.8.5", optional = true, default-features = false, features = ["with-alloc"] }
crc32fast = "1.2.0"

[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
miniz_oxide = { version = "0.8.4", default-features = false, features = ["with-alloc"] }
miniz_oxide = { version = "0.8.5", default-features = false, features = ["with-alloc"] }

[dev-dependencies]
rand = "0.9"
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -67,8 +67,20 @@ fn main() {

## Backends

The default `miniz_oxide` backend has the advantage of being pure Rust. If you
want maximum performance, you can use the zlib-ng C library:
The default `miniz_oxide` backend has the advantage of only using safe Rust.

If you want maximum performance while still benefiting from a Rust
implementation at the cost of some `unsafe`, you can use `zlib-rs`:

```toml
[dependencies]
flate2 = { version = "1.0.17", features = ["zlib-rs"], default-features = false }
```

### C backends

While zlib-rs is [the fastest overall](https://trifectatech.org/blog/zlib-rs-is-faster-than-c/),
the zlib-ng C library can be slightly faster in certain cases:

```toml
[dependencies]
2 changes: 1 addition & 1 deletion src/ffi/c.rs
Original file line number Diff line number Diff line change
@@ -467,7 +467,7 @@ mod c_backend {
#[cfg(feature = "zlib-ng")]
const ZLIB_VERSION: &'static str = "2.1.0.devel\0";
#[cfg(all(not(feature = "zlib-ng"), feature = "zlib-rs"))]
const ZLIB_VERSION: &'static str = "1.3.0-zlib-rs-0.4.2\0";
const ZLIB_VERSION: &'static str = "1.3.0-zlib-rs-0.5.0\0";
#[cfg(not(any(feature = "zlib-ng", feature = "zlib-rs")))]
const ZLIB_VERSION: &'static str = "1.2.8\0";

26 changes: 12 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -17,20 +17,18 @@
//! backends, controlled through this crate's features:
//!
//! * `default`, or `rust_backend` - this implementation uses the `miniz_oxide`
//! crate which is a port of `miniz.c` (below) to Rust. This feature does not
//! require a C compiler and only requires Rust code.
//!
//! * `zlib` - this feature will enable linking against the `libz` library, typically found on most
//! Linux systems by default. If the library isn't found to already be on the system it will be
//! compiled from source (this is a C library).
//!
//! There's various tradeoffs associated with each implementation, but in general you probably
//! won't have to tweak the defaults. The default choice is selected to avoid the need for a C
//! compiler at build time. `zlib-ng-compat` is useful if you're using zlib for compatibility but
//! want performance via zlib-ng's zlib-compat mode. `zlib` is useful if something else in your
//! dependencies links the original zlib so you cannot use zlib-ng-compat. The compression ratios
//! and performance of each of these feature should be roughly comparable, but you'll likely want
//! to run your own tests if you're curious about the performance.
//! crate which is a port of `miniz.c` to Rust. This feature does not
//! require a C compiler, and only uses safe Rust code.
//!
//! * `zlib-rs` - this implementation utilizes the `zlib-rs` crate, a Rust rewrite of zlib.
//! This backend is the fastest, at the cost of some `unsafe` Rust code.
//!
//! Several backends implemented in C are also available.
//! These are useful in case you are already using a specific C implementation
//! and need the result of compression to be bit-identical.
//! See the crate's README for details on the available C backends.
//!
//! The `zlib-rs` backend typically outperforms all the C implementations.
//!
//! # Organization
//!