Conversation
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.
There was a problem hiding this comment.
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.
carlocab
left a comment
There was a problem hiding this comment.
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.
@samford If possible for a follow-up: maybe enable that unconditionally in CI and just skip locally? |
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 |
brew lgtm(style, typechecking and tests) with your changes locally?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 = 1andlto = truetoprofile.releasebut it doubles compile time on my machine. It's worth doing if/when we get to a point where we compilebrew-rsin 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.