use zlib-rs
for gzip compression in rust code
#15417
Merged
+21
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
This PR uses
zlib-rs
via theflate2
crate. It is used for (de)compressing gzip files (e.g. incargo package
).Using zlib-rs is significantly faster, and produces output of roughly similar size. For the
windows-bindgen
crate(a very large crate), the speedup is over 60%, or about 2 seconds.
How should we test and review this PR?
Generally CI/the test suite should handle correctness.
Something to look out for is zlib-rs producing larger binaries than before. So far we're seeing output sizes that are roughly the same (sometimes a bit better, sometimes a bit worse) as the status quo.
We've not specifically looked at decompression yet, mostly because we could not come up with a good command to benchmark. In general zlib-rs is much faster than stock zlib there too.
Additional information
For the time being,
cargo
still depends on stock zlib via e.g.curl
andgit
. As far as I know it is the intention to eventually move away from these C dependencies, at which point the dependency on stock zlib also disappears.