Skip to content

Commit

Permalink
Reduce size of release binary (#592)
Browse files Browse the repository at this point in the history
This PR makes 3 changes that together reduce binary size by around 25%:
- Sets lto="fat" in cargo.toml
- Sets panic="abort" in cargo.toml
- Sets location-detail=none in RUSTFLAGS

Closes #571

An unrelated change: I've replaced the zopfli test file with a smaller
one that runs much faster, as well as removing the slow test for
issue-133 which was related to an older alpha optimisation that is no
longer relevant.
  • Loading branch information
andrews05 authored Feb 20, 2024
1 parent 4cb8296 commit 98fd4de
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/workflows/oxipng.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:

env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
RUSTFLAGS: -Zlocation-detail=none

steps:
- name: Checkout source
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ path = "src/lib.rs"
opt-level = 2

[profile.release]
lto = "thin"
lto = "fat"
strip = "symbols"

[profile.dev.package.bitvec]
opt-level = 3
panic = "abort"
Binary file removed tests/files/issue-133.png
Binary file not shown.
Binary file modified tests/files/zopfli_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ fn zopfli_mode() {
input,
&output,
&opts,
RGB,
INDEXED,
BitDepth::Eight,
RGB,
INDEXED,
BitDepth::Eight,
);
}
15 changes: 0 additions & 15 deletions tests/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,21 +315,6 @@ fn issue_129() {
);
}

#[test]
fn issue_133() {
let input = "tests/files/issue-133.png";
let (output, mut opts) = get_opts(Path::new(input));
opts.optimize_alpha = true;
test_it_converts(
input,
Some((output, opts)),
RGBA,
BitDepth::Eight,
RGBA,
BitDepth::Eight,
);
}

#[test]
fn issue_140() {
test_it_converts(
Expand Down

0 comments on commit 98fd4de

Please sign in to comment.