Skip to content

Enable strip in release mode by default #4122

Closed
@SuperCuber

Description

@SuperCuber

I'd expect build --release to apply all optimisations, and one of them would be file size.

I tried two programs, a trivial "hello rust" and a trivial "hello panic". Both of their sizes were 3.8M which is pretty crazy for something that is supposed to be optimised... So I tried strip --strip-alling the executables.

Hello rust went to 372K
Hello panic went to 364K

That's a pretty huge change... The only difference in functionality I found is that RUST_BACKTRACE=1 shows a lot of <unknown>s on striped files which is to be expected, but I think that's not a real issue because the whole point of --release is that it's not supposed to be debugged, there is the normal build for that...

For now I will be strip --strip-alling all of my released executables but I really don't see a reason why build --release doesn't do it. I'd be happy to be enlightened if I missed anything though!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-buildS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewS-needs-team-inputStatus: Needs input from team on whether/how to proceed.T-cargoTeam: Cargodisposition-mergeFCP with intent to mergefinished-final-comment-periodFCP complete

    Type

    No type

    Projects

    Status

    FCP merge

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions