Adjust buffer sizes for ZipArchive

This commit is contained in:
Joakim Soderlund 2021-08-29 20:29:01 +02:00
parent ac93b0dcfb
commit cf9be968be
3 changed files with 33 additions and 12 deletions

39
Cargo.lock generated
View file

@ -35,6 +35,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.69" version = "1.0.69"
@ -357,12 +363,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "podio"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.28" version = "1.0.28"
@ -534,6 +534,26 @@ dependencies = [
"unicode-xid", "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]] [[package]]
name = "time" name = "time"
version = "0.1.44" version = "0.1.44"
@ -605,11 +625,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "zip" name = "zip"
version = "0.5.6" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58287c28d78507f5f91f2a4cf1e8310e2c76fd4c6932f93ac60fd1ceb402db7d" checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
dependencies = [ dependencies = [
"byteorder",
"crc32fast", "crc32fast",
"flate2", "flate2",
"podio", "thiserror",
] ]

View file

@ -41,6 +41,6 @@ features = ["derive"]
version = "*" version = "*"
[dependencies.zip] [dependencies.zip]
version = "<0.5.7" version = "*"
features = ["deflate"] features = ["deflate"]
default-features = false default-features = false

View file

@ -29,7 +29,7 @@ impl Fetcher<BufReader<File>> {
_ => Error::archive("Could not open file"), _ => 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<T: Read + Seek> Fetcher<T> {
_ => Error::archive("Could not open story index"), _ => 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> { pub fn fetch(&self, key: i64) -> Option<&Story> {