Skip to content

brew-rs: enable strip for release#21836

Open
samford wants to merge 1 commit intomainfrom
brew-rs-enable-strip-for-release
Open

brew-rs: enable strip for release#21836
samford wants to merge 1 commit intomainfrom
brew-rs-enable-strip-for-release

Conversation

@samford
Copy link
Member

@samford samford commented Mar 25, 2026


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Unless we need (or would benefit from) symbols, stripping them reduces binary size from 6.3 MB to 5 MB without any notable change to build time.

Binary size could be further reduced to 3.9 MB by adding codegen-units = 1 and lto = true to profile.release but it doubles compile time on my machine. It's worth doing if/when we get to a point where we compile brew-rs in CI and ship binaries to users but I've left those off for now to keep compile time down.

That said, feel free to pass on this if it's not beneficial at this stage.

Unless we need (or would benefit from) symbols, stripping them reduces
binary size from 6.3 MB to 5 MB without any notable change to build
time.

Binary size could be further reduced to 3.9 MB by adding
`codegen-units = 1` and `lto = true` to `profile.release` but it
doubles compile time on my machine. It's worth doing if/when we get to
a point where we compile `brew-rs` in CI and ship binaries to users
but I've left those off for now to keep compile time down.
Copilot AI review requested due to automatic review settings March 25, 2026 22:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces the size of the experimental brew-rs Rust frontend binary by enabling symbol stripping for release builds via Cargo’s release profile settings.

Changes:

  • Configure Cargo release builds to strip symbols for brew-rs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to do this yet; the symbols are useful if you want to attach this to a debugger.

In the longer-term it might be nice to keep a build with debug symbols for users with HOMEBREW_DEVELOPER set.

@MikeMcQuaid
Copy link
Member

Binary size could be further reduced to 3.9 MB by adding codegen-units = 1 and lto = true to profile.release but it doubles compile time on my machine. It's worth doing if/when we get to a point where we compile brew-rs in CI and ship binaries to users but I've left those off for now to keep compile time down.

@samford If possible for a follow-up: maybe enable that unconditionally in CI and just skip locally?

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid
Copy link
Member

We probably don't want to do this yet; the symbols are useful if you want to attach this to a debugger.

We're not doing this really at the moment and it should be a debug build, not a release one, in that case.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2026
@samford
Copy link
Member Author

samford commented Mar 26, 2026

We're not doing this really at the moment and it should be a debug build, not a release one, in that case.

I agree. The debug profile includes debug information that's omitted by default in the release profile, so the release build isn't the best for debugging.

We're not using debug builds at the moment but if you want to debug the release build in the interim time, you would probably want to temporarily add debug = true to profile.release, so it should be easy to comment out strip = "symbols" at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants