Strip ff2mpv-rust binary in release build #9

Closed
opened 2023-10-29 20:27:12 +01:00 by MarkusPettersson98 · 1 comment
MarkusPettersson98 commented 2023-10-29 20:27:12 +01:00 (Migrated from github.com)

Currently a regular release build is not stripped, which means that the produced binary is unnecessarily fat

$ cargo build --release &> /dev/null && ls -la target/release/ff2mpv-rust
.rwxr-xr-x@ 4.9M <user> 29 Oct 20:10 target/release/ff2mpv-rust

This is solved by building with the provided release-full Cargo profile

$ cargo build --profile release-full &> /dev/null && ls -la target/release-full/ff2mpv-rust
.rwxr-xr-x@ 503k <user> 29 Oct 20:10 target/release-full/ff2mpv-rust

Is there any particular reason why a regular release-build is not stripped? I would assume that the most common way to install the ff2mpv-rust binary is by running cargo install --path . from the project root, but this will build the binary using the regular release profile (i.e. the fat binary). To actually install the optimized binary, one would have to run cargo install --profile=release-full --path . instead.

If you don't wan to strip the regular release binary, it would be nice to at least document how to install the optimized binary, preferably in the project README 😊

Currently a regular release build is not stripped, which means that the produced binary is unnecessarily fat ```bash $ cargo build --release &> /dev/null && ls -la target/release/ff2mpv-rust .rwxr-xr-x@ 4.9M <user> 29 Oct 20:10 target/release/ff2mpv-rust ``` This is solved by building with the provided `release-full` Cargo profile ```bash $ cargo build --profile release-full &> /dev/null && ls -la target/release-full/ff2mpv-rust .rwxr-xr-x@ 503k <user> 29 Oct 20:10 target/release-full/ff2mpv-rust ``` Is there any particular reason why a regular release-build is not stripped? I would assume that the most common way to install the `ff2mpv-rust` binary is by running `cargo install --path .` from the project root, but this will build the binary using the regular release profile (i.e. the fat binary). To actually install the optimized binary, one would have to run `cargo install --profile=release-full --path .` instead. If you don't wan to strip the regular release binary, it would be nice to at least document how to install the optimized binary, preferably in the project `README` :blush:
ryze312 commented 2023-10-30 22:26:08 +01:00 (Migrated from github.com)

Typically I would use release profile for testing in the development workflow, but use release-full profile for the actual release. Compilation with LTO enabled could take a long time, especially with a lot of crates.
Haven't thought that this would affect cargo install honestly.
Perhaps inheriting dev and changing optimization level would be better.

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

[profile.dev-optimized]
inherits = "dev"
opt-level = 3
Typically I would use `release` profile for testing in the development workflow, but use `release-full` profile for the actual release. Compilation with LTO enabled could take a long time, especially with a lot of crates. Haven't thought that this would affect `cargo install` honestly. Perhaps inheriting `dev` and changing optimization level would be better. ```toml [profile.release] strip = "symbols" lto = "fat" [profile.dev-optimized] inherits = "dev" opt-level = 3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: ryze/ff2mpv-rust#9
No description provided.