Skip to content

Commit 97f6819

Browse files
committed
use zlib-rs for gzip compression in rust code
Various C dependencies (curl, git) still rely on `libz-sys`, so for the time being a system libc is still required. But, using zlib-rs via flate2 is straightforward, and gives good speedup for `cargo package`. It is also extremely portable, because it's just rust code.
1 parent b909a8b commit 97f6819

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

Cargo.lock

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ criterion = { version = "0.5.1", features = ["html_reports"] }
4545
curl = "0.4.47"
4646
curl-sys = "0.4.79"
4747
filetime = "0.2.25"
48-
flate2 = { version = "1.0.35", default-features = false, features = ["zlib"] }
48+
flate2 = { version = "1.1.1", default-features = false, features = ["zlib-rs"] }
4949
git2 = "0.20.0"
5050
git2-curl = "0.21.0"
5151
gix = { version = "0.70.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The build will automatically use vendored versions of the following libraries. H
5757
* [`libcurl`](https://curl.se/libcurl/) — Used for network transfers.
5858
* [`libgit2`](https://libgit2.org/) — Used for fetching git dependencies.
5959
* [`libssh2`](https://www.libssh2.org/) — Used for SSH access to git repositories.
60-
* [`libz`](https://zlib.net/) (aka zlib) — Used for data compression.
60+
* [`libz`](https://zlib.net/) (AKA zlib) — Used by the above C libraries for data compression. (Rust code uses [`zlib-rs`](https://github.com/trifectatechfoundation/zlib-rs) instead.)
6161

6262
It is recommended to use the vendored versions as they are the versions that are tested to work with Cargo.
6363

src/doc/src/reference/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ The [`default` features](#the-default-feature) can be disabled using
187187

188188
```toml
189189
[dependencies]
190-
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
190+
flate2 = { version = "1.0.3", default-features = false, features = ["zlib-rs"] }
191191
```
192192

193193
> **Note**: This may not ensure the default features are disabled. If another

0 commit comments

Comments
 (0)