From cf9be968be3ffb9fe3094abe072efc262d4d4ace Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sun, 29 Aug 2021 20:29:01 +0200 Subject: [PATCH] Adjust buffer sizes for ZipArchive --- Cargo.lock | 39 ++++++++++++++++++++++++++++++--------- Cargo.toml | 2 +- src/archive/fetcher.rs | 4 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae7c7e5..c239e7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,6 +35,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "cc" version = "1.0.69" @@ -357,12 +363,6 @@ dependencies = [ "libc", ] -[[package]] -name = "podio" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19" - [[package]] name = "proc-macro2" version = "1.0.28" @@ -534,6 +534,26 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "thiserror" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "283d5230e63df9608ac7d9691adc1dfb6e701225436eb64d0b9a7f0a5a04f6ec" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa3884228611f5cd3608e2d409bf7dce832e4eb3135e3f11addbd7e41bd68e71" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" version = "0.1.44" @@ -605,11 +625,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "zip" -version = "0.5.6" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58287c28d78507f5f91f2a4cf1e8310e2c76fd4c6932f93ac60fd1ceb402db7d" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" dependencies = [ + "byteorder", "crc32fast", "flate2", - "podio", + "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index f333341..03b94a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,6 @@ features = ["derive"] version = "*" [dependencies.zip] -version = "<0.5.7" +version = "*" features = ["deflate"] default-features = false diff --git a/src/archive/fetcher.rs b/src/archive/fetcher.rs index f86d6d0..fc014c5 100644 --- a/src/archive/fetcher.rs +++ b/src/archive/fetcher.rs @@ -29,7 +29,7 @@ impl Fetcher> { _ => Error::archive("Could not open file"), })?; - Self::with_reader(BufReader::with_capacity(8_000_000, file)) + Self::with_reader(BufReader::new(file)) } } @@ -60,7 +60,7 @@ impl Fetcher { _ => Error::archive("Could not open story index"), })?; - parse(BufReader::with_capacity(8_000_000, file)).map_err(Error::index) + parse(BufReader::with_capacity(1048576, file)).map_err(Error::index) } pub fn fetch(&self, key: i64) -> Option<&Story> {