Reduce size of release binary (#592)

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.
This commit is contained in:
andrews05 2024-02-21 07:02:12 +13:00 committed by GitHub
parent 4cb8296b02
commit 98fd4de30a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5 additions and 21 deletions

View file

@ -55,6 +55,7 @@ jobs:
env: env:
CARGO_BUILD_TARGET: ${{ matrix.target }} CARGO_BUILD_TARGET: ${{ matrix.target }}
RUSTFLAGS: -Zlocation-detail=none
steps: steps:
- name: Checkout source - name: Checkout source

View file

@ -95,8 +95,6 @@ path = "src/lib.rs"
opt-level = 2 opt-level = 2
[profile.release] [profile.release]
lto = "thin" lto = "fat"
strip = "symbols" strip = "symbols"
panic = "abort"
[profile.dev.package.bitvec]
opt-level = 3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -686,9 +686,9 @@ fn zopfli_mode() {
input, input,
&output, &output,
&opts, &opts,
RGB, INDEXED,
BitDepth::Eight, BitDepth::Eight,
RGB, INDEXED,
BitDepth::Eight, BitDepth::Eight,
); );
} }

View file

@ -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] #[test]
fn issue_140() { fn issue_140() {
test_it_converts( test_it_converts(