From 91bb84d5a8bab87226be0c832d274d11e67c7fd0 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 18:33:19 +1000 Subject: [PATCH 1/5] Optimize dep tokio: Disable all feature except rt-multi-thread, macros and process Signed-off-by: Jiahao XU --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ddbe4f9c..c5d3ac9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,10 @@ strum_macros = "0.24.0" tar = "0.4.38" tempfile = "3.3.0" tinytemplate = "1.2.1" -tokio = { version = "1.18.0", features = [ "full" ] } + +# This crate uses features rt-multi-thread and macros in `#[tokio::main]` and +# uses feature process to create process. +tokio = { version = "1.18.0", features = [ "rt-multi-thread", "macros", "process" ], default-features = false } url = "2.2.2" xz2 = "0.1.6" zip = "0.6.2" From 355895d8b669e9a183d0ae39ba97ab650b530c8f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 18:37:49 +1000 Subject: [PATCH 2/5] Disable all features of `zip` except deflate, bzip2 and zstd Signed-off-by: Jiahao XU --- Cargo.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c5d3ac9e..7cb56f33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,13 @@ tinytemplate = "1.2.1" tokio = { version = "1.18.0", features = [ "rt-multi-thread", "macros", "process" ], default-features = false } url = "2.2.2" xz2 = "0.1.6" -zip = "0.6.2" +# Disable all features of zip except for features of compression algorithms: +# Disable features include: +# - aes-crypto: Enables decryption of files which were encrypted with AES, absolutely zero use for +# this crate. +# - time: Enables features using the [time](https://github.com/time-rs/time) crate, +# which is not used by this crate. +zip = { version = "0.6.2", default-features = false, features = [ "deflate", "bzip2", "zstd" ] } # zstd is also depended by zip. # Since zip 0.6.2 depends on zstd 0.10.0, we also have to use 0.10.0 here, # otherwise there will be a link conflict. From 20b2c37ffbdd5bf897da3c6cdd79233173622d2f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 18:45:05 +1000 Subject: [PATCH 3/5] Bump dep flate2 to v1.0.24 Signed-off-by: Jiahao XU --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7cb56f33..72bbf125 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ cargo_metadata = "0.14.2" cargo_toml = "0.11.4" crates_io_api = { version = "0.8.0", default-features = false, features = ["rustls"] } dirs = "4.0.0" -flate2 = "1.0.22" +flate2 = { version = "1.0.24" } log = "0.4.14" reqwest = { version = "0.11.10", features = [ "rustls-tls" ], default-features = false } semver = "1.0.7" From fff4b7225613351a9bbf17c3077d704384c58047 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 18:47:57 +1000 Subject: [PATCH 4/5] Enable feature zlib-ng of flate2 so that zlib-ng is used which is the fastest implementation flate2 supports. Signed-off-by: Jiahao XU --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 72bbf125..f2009264 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ cargo_metadata = "0.14.2" cargo_toml = "0.11.4" crates_io_api = { version = "0.8.0", default-features = false, features = ["rustls"] } dirs = "4.0.0" -flate2 = { version = "1.0.24" } +flate2 = { version = "1.0.24", features = ["zlib-ng"], default-features = false } log = "0.4.14" reqwest = { version = "0.11.10", features = [ "rustls-tls" ], default-features = false } semver = "1.0.7" From 39580cdc51911b1940bbdbe8ea63fb5f57e374a8 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 18:49:15 +1000 Subject: [PATCH 5/5] Update `Cargo.lock` Signed-off-by: Jiahao XU --- Cargo.lock | 212 +++-------------------------------------------------- 1 file changed, 10 insertions(+), 202 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 389cf211..feb71914 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,18 +8,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] - [[package]] name = "aho-corasick" version = "0.7.18" @@ -78,12 +66,6 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" -[[package]] -name = "base64ct" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b" - [[package]] name = "bindgen" version = "0.59.2" @@ -113,15 +95,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - [[package]] name = "bumpalo" version = "3.9.1" @@ -268,15 +241,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - [[package]] name = "clang-sys" version = "1.3.3" @@ -304,18 +268,12 @@ dependencies = [ ] [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "cmake" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" dependencies = [ - "libc", + "cc", ] [[package]] @@ -354,27 +312,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "crypto-common" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - [[package]] name = "dirs" version = "4.0.0" @@ -451,6 +388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ "crc32fast", + "libz-ng-sys", "miniz_oxide", ] @@ -559,16 +497,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.6" @@ -635,15 +563,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "http" version = "0.2.7" @@ -810,13 +729,13 @@ dependencies = [ ] [[package]] -name = "lock_api" -version = "0.4.7" +name = "libz-ng-sys" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "4399ae96a9966bf581e726de86969f803a81b7ce795fcd5480e640589457e0f2" dependencies = [ - "autocfg", - "scopeguard", + "cmake", + "libc", ] [[package]] @@ -938,58 +857,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "password-hash" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "pbkdf2" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7" -dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", -] - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -1062,12 +929,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" - [[package]] name = "redox_syscall" version = "0.2.13" @@ -1206,12 +1067,6 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "sct" version = "0.7.0" @@ -1274,28 +1129,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "shlex" version = "1.1.0" @@ -1328,12 +1161,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - [[package]] name = "socket2" version = "0.4.4" @@ -1399,12 +1226,6 @@ dependencies = [ "syn", ] -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - [[package]] name = "syn" version = "1.0.95" @@ -1534,7 +1355,6 @@ dependencies = [ "mio", "num_cpus", "once_cell", - "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -1631,12 +1451,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - [[package]] name = "unicode-bidi" version = "0.3.8" @@ -1935,17 +1749,11 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf225bcf73bb52cbb496e70475c7bd7a3f769df699c0020f6c7bd9a96dcf0b8d" dependencies = [ - "aes", "byteorder", "bzip2", - "constant_time_eq", "crc32fast", "crossbeam-utils", "flate2", - "hmac", - "pbkdf2", - "sha1", - "time", "zstd", ]