build: enable lto + codegen-units=1 for release profile#85
Open
build: enable lto + codegen-units=1 for release profile#85
Conversation
Shrinks the prebuilt protoc-gen-buffa* release binaries by ~20% at the cost of ~2x clean release-build time. Only the workspace root profile is set (Cargo ignores per-crate profile sections inside a workspace, and the warning noise outweighs the cargo-install benefit); the guide documents the CARGO_PROFILE_RELEASE_LTO env-var path for cargo install users, and the CHANGELOG notes that library consumers do not inherit this.
|
All contributors have signed the CLA ✍️ ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60.
Adds
lto = trueandcodegen-units = 1to the workspace[profile.release].Effect
protoc-gen-buffaprotoc-gen-buffa-packagingClean
cargo build --release -p protoc-gen-buffa -p protoc-gen-buffa-packaging: ~10 s → ~27 s.Scope
buffa/buffa-build— Cargo only honors[profile.*]from the top-level workspace. The CHANGELOG entry calls this out.cargo install protoc-gen-buffa— the workspace manifest isn't published. Adding per-crate[profile.release]to the plugin manifests was considered but produces a "profiles for the non root package will be ignored" warning on every workspace build. The guide's "Installing the protoc plugins" section now documents theCARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 cargo install ...form instead.Semver
No public-API change. Suitable for 0.4.1.