perf: Change default compression implementation to flate2/zlib-ng

This commit is contained in:
Chris Hennick 2024-05-20 11:55:51 -07:00
parent 89b9b668ec
commit 6071dc13b0
No known key found for this signature in database
GPG key ID: DA47AABA4961C509
2 changed files with 7 additions and 10 deletions

View file

@ -67,24 +67,23 @@ tempdir = "0.3.7"
aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "rand", "zeroize"]
chrono = ["chrono/default"]
_deflate-any = []
_deflate-non-zopfli = ["_deflate-any"]
_all-features = [] # Detect when --all-features is used
deflate = ["flate2/rust_backend", "_deflate-any"]
deflate = ["flate2/rust_backend", "_deflate-non-zopfli"]
# DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend`
deflate-miniz = ["deflate", "_deflate-any"]
deflate-miniz = ["deflate", "_deflate-non-zopfli"]
deflate-zlib = ["flate2/zlib", "_deflate-any"]
deflate-zlib-ng = ["flate2/zlib-ng", "_deflate-any"]
deflate-zlib = ["flate2/zlib", "_deflate-non-zopfli"]
deflate-zlib-ng = ["flate2/zlib-ng", "_deflate-non-zopfli"]
deflate-zopfli = ["zopfli", "_deflate-any"]
lzma = ["lzma-rs/stream"]
unreserved = []
default = [
"aes-crypto",
"bzip2",
"deflate",
"deflate64",
"deflate-zlib-ng",
"deflate-zopfli",
"lzma",
"time",
"zstd",

View file

@ -1516,7 +1516,7 @@ impl<W: Write + Seek> GenericZipWriter<W> {
}
#[cfg(feature = "_deflate-any")]
CompressionMethod::Deflated => {
let default = if cfg!(feature = "deflate-zopfli") {
let default = if cfg!(all(feature = "deflate-zopfli", not(feature = "_deflate-non-zopfli"))) {
24
} else {
Compression::default().level() as i64
@ -1694,9 +1694,7 @@ impl<W: Write + Seek> GenericZipWriter<W> {
#[cfg(feature = "_deflate-any")]
fn deflate_compression_level_range() -> std::ops::RangeInclusive<i64> {
let min = if cfg!(feature = "deflate")
|| cfg!(feature = "deflate-zlib")
|| cfg!(feature = "deflate-zlib-ng")
let min = if cfg!(feature = "_deflate-non-zopfli")
{
Compression::none().level() as i64
} else {