Skip to content

Tweak Cargo settings for the Release profile #211

@zamazan4ik

Description

@zamazan4ik

Hi!

Thank you for the project! Just an hour ago needed to find a solution exactly like yours, and found this application :)

During the compilation for my local use (on Fedora), I found that default Cargo options for the Release build can be optimized, so users by default will get a smaller binary (with at least the same performance) by enabling additional stable Cargo flags for the Release profile.

I have made quick tests (AMD Ryzen 9 5900x, Fedora 43, Rust 1.92, the latest version of the project at the moment, cargo build --release --no-default-features -F gui,ffmpeg,pulse,mpris command) - here are the results:

  • Release (the current profile): 9.8 Mib, clean build time: 35s
  • Release + FullLTO + CU1: 6.2 Mib, clean build time: 1m 02s
  • Ripgrep profile: 4.9 Mib, clean build time: 59s

Release + FullLTO + CU1 profile:

[profile.release]
codegen-units = 1
lto = "fat"

Ripgrep profile (inspired by this):

[profile.release]
opt-level = 3
debug = "none"
strip = "symbols"
debug-assertions = false
overflow-checks = false
lto = "fat"
panic = "abort"
incremental = false
codegen-units = 1

Build time increase shouldn't be a problem since we enable it only for the Release profile.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions