Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Request: Strip binary and/or LTO #129

Closed
jakobnissen opened this issue Aug 19, 2022 · 1 comment
Closed

Request: Strip binary and/or LTO #129

jakobnissen opened this issue Aug 19, 2022 · 1 comment

Comments

@jakobnissen
Copy link

jakobnissen commented Aug 19, 2022

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

@wwood wwood closed this as completed in 36022eb Aug 19, 2022
@wwood
Copy link
Owner

wwood commented Aug 19, 2022

Indeed. Good suggestions - thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants