Skip to content

Request: Strip binary and/or LTO #129

@jakobnissen

Description

@jakobnissen

Newer versions of cargo allows symbols to automatically be stripped from the binary in release mode. Simply add the following to your Cargo.toml

[profile.release]
strip = true

This approximately halves the size of the binary on my computer, which makes it more attractive to ship CoverM e.g. as a dependency.
The downside is that stack traces will become useless. But I'm guessing the fraction of your users who know how to enable stack traces in Rust to debug an internal CoverM problem is miniscule. And among those who would know, they probably also know to just compile in debug mode if they want to debug. The quality of error messages on panics are unaffected, so since stack traces are disabled by default in Rust, the user should not see a difference.

You can also add lto = true under the [profile.release] section to enable link-time optimisation. This both improve binary size and might also improve performance (i.e .speed) of CoverM, but at the cost of longer compile times. However, on my laptop CoverM compiled in like 3 minutes in release mode with lto enabled, so it's probably worth it.

Both optimisations cut the binary size on my computer from 9.9M -> 4.7M

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions