Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Changed

- The workspace `[profile.release]` now sets `lto = true` and
`codegen-units = 1`. This shrinks the prebuilt `protoc-gen-buffa` /
`protoc-gen-buffa-packaging` release binaries by roughly 20% at the cost of
~2× clean release-build time. Cargo only honors profile sections from the
top-level workspace, so library consumers of `buffa` / `buffa-build` do not
inherit this — set `[profile.release]` in your own workspace (or
`CARGO_PROFILE_RELEASE_LTO=true` for `cargo install`) to get the same
benefit. ([#60](https://github.com/anthropics/buffa/issues/60))

### Fixed

- `write_to` now emits fields in ascending field-number order regardless of
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ repository = "https://github.com/anthropics/buffa"
keywords = ["protobuf", "protocol-buffers", "serialization", "no-std", "editions"]
categories = ["encoding", "no-std"]

# Applies to release builds within this workspace (CI-built release binaries,
# benchmarks, conformance). Library consumers do not inherit this — Cargo only
# honors [profile.*] from the top-level workspace, so a project depending on
# buffa/buffa-build must set its own [profile.release] to get LTO.
[profile.release]
lto = true
codegen-units = 1

[workspace.dependencies]
buffa = { path = "buffa", version = "0.4.0", default-features = false }
buffa-types = { path = "buffa-types", version = "0.4.0" }
Expand Down
7 changes: 7 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ From crates.io (recommended):
cargo install --locked protoc-gen-buffa protoc-gen-buffa-packaging
```

`cargo install` builds with its own default release profile, so the workspace's `lto = true` / `codegen-units = 1` settings (used for the prebuilt release binaries below) are not applied. For the smallest binary, set them via the environment:

```sh
CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
cargo install --locked protoc-gen-buffa protoc-gen-buffa-packaging
```

Or from a git ref, for unreleased changes:

```sh
Expand Down
Loading