diff --git a/Cargo.toml b/Cargo.toml index 57111fae..5a5f19a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,12 @@ parallel = ["rayon", "indexmap/rayon"] [lib] name = "oxipng" path = "src/lib.rs" + [profile.dev] opt-level = 2 + [profile.release] lto = "thin" + +[profile.dev.package.bit-vec] +opt-level = 3 diff --git a/src/reduction/bit_depth.rs b/src/reduction/bit_depth.rs index 75ad95df..aef295cf 100644 --- a/src/reduction/bit_depth.rs +++ b/src/reduction/bit_depth.rs @@ -75,7 +75,6 @@ pub fn reduce_bit_depth(png: &PngImage, minimum_bits: usize) -> Option #[must_use] pub fn reduce_bit_depth_8_or_less(png: &PngImage, mut minimum_bits: usize) -> Option { assert!((1..8).contains(&minimum_bits)); - let mut reduced = BitVec::with_capacity(png.data.len() * 8); let bit_depth: usize = png.ihdr.bit_depth.as_u8() as usize; if minimum_bits >= bit_depth { return None; @@ -130,6 +129,7 @@ pub fn reduce_bit_depth_8_or_less(png: &PngImage, mut minimum_bits: usize) -> Op } } + let mut reduced = BitVec::with_capacity(png.data.len() * 8); for line in png.scan_lines() { reduced.extend(BitVec::from_bytes(&[line.filter])); let bit_vec = BitVec::from_bytes(&line.data); diff --git a/tests/flags.rs b/tests/flags.rs index 69d79f6a..6da0ac62 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -494,6 +494,7 @@ fn fix_errors() { } #[test] +#[cfg(feature = "zopfli")] fn zopfli_mode() { let input = PathBuf::from("tests/files/zopfli_mode.png"); let (output, mut opts) = get_opts(&input); @@ -511,6 +512,7 @@ fn zopfli_mode() { } #[test] +#[cfg(feature = "libdeflater")] fn libdeflater_mode() { let input = PathBuf::from("tests/files/zopfli_mode.png"); let (output, mut opts) = get_opts(&input);