From e67b7858e688e31db17fb94d2aeaa0131f0ee61c Mon Sep 17 00:00:00 2001 From: bojanserafimov Date: Tue, 9 Jan 2024 16:13:36 -0500 Subject: [PATCH] Use zlib-ng for faster decompression (#859) --- Cargo.lock | 20 ++++++++++++++++++++ Cargo.toml | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 16aa771e3..82888df9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -557,6 +557,15 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -922,6 +931,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", + "libz-ng-sys", "miniz_oxide", ] @@ -1655,6 +1665,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libz-ng-sys" +version = "1.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81157dde2fd4ad2b45ea3a4bb47b8193b52a6346b678840d91d80d3c2cd166c5" +dependencies = [ + "cmake", + "libc", +] + [[package]] name = "libz-sys" version = "1.1.12" diff --git a/Cargo.toml b/Cargo.toml index 9228fca79..f74838c44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,10 @@ data-encoding = { version = "2.5.0" } derivative = { version = "2.2.0" } directories = { version = "5.0.1" } dirs = { version = "5.0.1" } -flate2 = { version = "1.0.28" } +# This tells flate2 (and all libraries that depend on it, including async_compression +# and async_zip) to use zlib-ng, which about 2x faster than the default flate2 backend +# at decompression. See https://github.com/rust-lang/flate2-rs#backends +flate2 = { version = "1.0.28", features = ["zlib-ng"], default-features = false } fs-err = { version = "2.11.0" } fs2 = { version = "0.4.3" } futures = { version = "0.3.30" }