Skip to content

Commit

Permalink
Replace miniz_sys with miniz_oxide, a Rust implementation of miniz
Browse files Browse the repository at this point in the history
This also improves decompression performance by 15%, and obsoletes the
`--zm` parameter.

Closes #57
  • Loading branch information
shssoichiro committed Jan 31, 2018
1 parent 0c2e377 commit fe9cd01
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 264 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
### Version 0.19.1 (unreleased)
### Version 0.20.0 (unreleased)
- Refactor of internal code.
- Implement unix-specific permissions copying for `-p` option
- Performance optimizations
- Remove the C dependency on miniz, and replace it with a Rust version ([#57](https://github.com/shssoichiro/oxipng/issues/57))
- This improves decompression speed by 15%. Compression speed is not affected.
- [SEMVER_MAJOR] This also obsoletes the `-zm` command line option and the `memory` key on the `Options` struct.
- Presets will be updated automatically. This means that presets 3 and higher will run significantly more quickly.

### Version 0.19.0
- [SEMVER_MAJOR] Default to overwriting the input file if `out_file` is not set.
Expand Down
16 changes: 5 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ crc = "^1.2.0"
glob = "0.2.11"
itertools = "^0.7.0"
libc = "^0.2.4"
miniz-sys = "^0.1.7"
num_cpus = "^1.0.0"
rayon = "^0.9.0"
zopfli = "^0.3.4"
miniz_oxide = "0.1.2"

[dependencies.clap]
optional = true
Expand Down
42 changes: 21 additions & 21 deletions benches/deflate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn deflate_16_bits_strategy_0(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 0, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 0, 15);
});
}

Expand All @@ -24,7 +24,7 @@ fn deflate_8_bits_strategy_0(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 0, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 0, 15);
});
}

Expand All @@ -36,7 +36,7 @@ fn deflate_4_bits_strategy_0(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 0, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 0, 15);
});
}

Expand All @@ -48,7 +48,7 @@ fn deflate_2_bits_strategy_0(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 0, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 0, 15);
});
}

Expand All @@ -60,7 +60,7 @@ fn deflate_1_bits_strategy_0(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 0, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 0, 15);
});
}

Expand All @@ -70,7 +70,7 @@ fn deflate_16_bits_strategy_1(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 1, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 1, 15);
});
}

Expand All @@ -80,7 +80,7 @@ fn deflate_8_bits_strategy_1(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 1, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 1, 15);
});
}

Expand All @@ -92,7 +92,7 @@ fn deflate_4_bits_strategy_1(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 1, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 1, 15);
});
}

Expand All @@ -104,7 +104,7 @@ fn deflate_2_bits_strategy_1(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 1, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 1, 15);
});
}

Expand All @@ -116,7 +116,7 @@ fn deflate_1_bits_strategy_1(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 1, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 1, 15);
});
}

Expand All @@ -126,7 +126,7 @@ fn deflate_16_bits_strategy_2(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 2, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 2, 15);
});
}

Expand All @@ -136,7 +136,7 @@ fn deflate_8_bits_strategy_2(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 2, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 2, 15);
});
}

Expand All @@ -148,7 +148,7 @@ fn deflate_4_bits_strategy_2(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 2, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 2, 15);
});
}

Expand All @@ -160,7 +160,7 @@ fn deflate_2_bits_strategy_2(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 2, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 2, 15);
});
}

Expand All @@ -172,7 +172,7 @@ fn deflate_1_bits_strategy_2(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 2, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 2, 15);
});
}

Expand All @@ -182,7 +182,7 @@ fn deflate_16_bits_strategy_3(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 3, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 3, 15);
});
}

Expand All @@ -192,7 +192,7 @@ fn deflate_8_bits_strategy_3(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 3, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 3, 15);
});
}

Expand All @@ -204,7 +204,7 @@ fn deflate_4_bits_strategy_3(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 3, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 3, 15);
});
}

Expand All @@ -216,7 +216,7 @@ fn deflate_2_bits_strategy_3(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 3, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 3, 15);
});
}

Expand All @@ -228,7 +228,7 @@ fn deflate_1_bits_strategy_3(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::deflate(png.raw_data.as_ref(), 9, 9, 3, 15).ok();
deflate::deflate(png.raw_data.as_ref(), 9, 3, 15);
});
}

Expand All @@ -238,6 +238,6 @@ fn inflate_generic(b: &mut Bencher) {
let png = png::PngData::new(&input, false).unwrap();

b.iter(|| {
deflate::inflate(png.idat_data.as_ref()).ok();
deflate::inflate(png.idat_data.as_ref());
});
}
Loading

0 comments on commit fe9cd01

Please sign in to comment.