Skip to content

build: tighten the release profile to fat LTO and one codegen unit - #1509

Merged
thiras merged 2 commits into
mainfrom
build/release-profile-fat-lto
Jul 29, 2026
Merged

thiras merged 2 commits into
mainfrom
build/release-profile-fat-lto

Conversation

@thiras

@thiras thiras commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

codegen-units was left at its default of 16, which was the binding constraint on the existing thin LTO — not the LTO mode. This sets lto = "fat" + codegen-units = 1, and relaxes strip from symbols to debuginfo so shipped binaries produce symbolized panic backtraces.

Measured

Clean builds of both binaries, 16 cores:

Profile Build decdn-node decdn
baseline (thin LTO, cgu=16) 356 s 47.40 MB 32.31 MB
thin LTO + cgu=1 361 s (+1.4%) 39.58 MB (−16.5%) 27.08 MB (−16.2%)
fat LTO + cgu=1 474 s (+33%) 35.58 MB (−25.0%) 21.11 MB (−34.7%)
fat LTO + cgu=1 + strip = "debuginfo" (this PR) — 41.35 MB (−12.8%) 24.17 MB (−25.2%)

CI never builds --release, so the added time falls only on the release workflow's 10-way parallel matrix and the Docker image build.

Why strip = "debuginfo"

Under strip = "symbols" a panic backtrace from an operator's node is bare addresses. Keeping the symbol table costs 5.7 MB on decdn-node and resolves frames to function names.

file:line is deliberately not bought here — it needs strip = "none" (91.8 MB for decdn-node) and cannot be moved to a sidecar: under split DWARF the line-number program stays in the executable's .debug_line, so a stripped binary plus its .dwp resolves nothing. Verified with addr2line, which returned :? identically with the 85 MB .dwp present and deleted. debug / split-debuginfo are therefore left off rather than generating 141 MB of sidecars that cannot symbolize the shipped artifact.

panic = "abort" is ruled out in the profile comment: production code recovers from panics via unwinding in chain_events::resumable_watcher (hook dispatch) and dht::chain_projection (lock poisoning), and the runtime / admin / buyer-channel layers branch on JoinError::is_panic.

Verification

Built both binaries on the final profile and inspected the artifacts:

  • .symtab present, zero .debug_* sections
  • addr2line resolves a live address to <decdn_node::receipt_log::ChannelReceiptSink as ...ReceiptSink>::record

Not covered

  • Runtime gain is unmeasured. Size is a proxy; the cross-crate inlining win through iroh/rustls/tokio would need a throughput benchmark.
  • Only the host target was built. rustc accepts the settings for all five release targets (checked via --emit=metadata), but the macOS / Windows / cross legs are not exercised until a real release runs.

Follow-ups

  • file:line via an objcopy --only-keep-debug sidecar in release.yml, uploaded per-target. Needs a per-OS branch (objcopy / dsymutil / MSVC PDB), and since build-binaries is skipped under dry_run, a mistake would only surface during a real release.
  • overflow-checks = true in release for the voucher / byte-offset arithmetic — a deliberate safety-vs-perf call, untouched here.

🤖 Generated with Claude Code

`codegen-units` was left at its default of 16, which was the binding
constraint on the existing thin LTO rather than the LTO mode itself.
Measured on a 16-core clean build of both binaries: cgu=1 alone costs
+5s (356s -> 361s) and takes ~16% off both; fat LTO on top costs +118s
and lands `decdn-node` at 35.6 MB and `decdn` at 21.1 MB. CI never
builds `--release`, so the extra time falls only on the release
workflow's 10-way parallel matrix and the Docker image build.

Also relax `strip` from `symbols` to `debuginfo` so the symbol table
survives in the shipped binary and a `RUST_BACKTRACE` panic from an
operator's node symbolizes to function names instead of bare addresses.
That gives up 5.7 MB of the LTO win on `decdn-node` (35.6 -> 41.3 MB),
still well below the 47.4 MB shipped today.

`file:line` resolution is deliberately not bought here. It requires
`strip = "none"`, which takes `decdn-node` to 91.8 MB, and it cannot be
moved into a sidecar: under split DWARF the line-number program stays
in the executable's `.debug_line`, so a stripped binary plus its `.dwp`
resolves nothing -- verified with addr2line, which returned `:?` both
with the 85 MB `.dwp` present and with it deleted. `debug` and
`split-debuginfo` are therefore left off rather than generating
sidecars that cannot symbolize the artifact being shipped.

`panic = "abort"` is ruled out in the same pass: production code
recovers from panics via unwinding in `chain_events::resumable_watcher`
and `dht::chain_projection`, and the runtime, admin, and buyer-channel
layers branch on `JoinError::is_panic`.

Verified on the built artifacts: `.symtab` present, zero `.debug_*`
sections, and addr2line resolves a live address to
`decdn_node::receipt_log::...::record`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 16:03
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (3)
  • chore(deps)
  • Renovate
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: c0f48352-a4fd-45a4-b112-34e71d7dd47b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the workspace release profile to prioritize runtime performance and smaller binaries via fat LTO and a single codegen unit, while retaining symbol tables so operator panic backtraces can resolve function names.

Changes:

  • Switch profile.release to lto = "fat" and codegen-units = 1 to enable whole-program optimization and maximize cross-crate inlining.
  • Relax strip from symbols to debuginfo so shipped release binaries keep symbol tables for function-name backtraces.

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

Comment thread Cargo.toml Resolved
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 80.23% (was 80.24%, ▼ 0.01%) — 53716/66954 lines

No Rust files changed in this PR.

History
Commit Total Δ vs base
caaf259 (HEAD) 80.23% ▼ 0.01%

@thiras
thiras merged commit cd12eb0 into main Jul 29, 2026
27 checks passed
@thiras
thiras deleted the build/release-profile-fat-lto branch July 29, 2026 16:14
alpergundogdu added a commit that referenced this pull request Jul 29, 2026
main advanced with #1508 (origin-aware discovery), #1504 (event-log replay
elimination), and #1509. One real conflict + one semantic reconciliation:

- crates/node/src/slash_watcher.rs: #1504 replaced the SlashJudge.Slashed event
  with CapacityBond.SlashRecorded (no offenseType field), so the Phase A test
  fixture edit is obsolete — took main's structure.
- crates/node/src/handlers/client/wire.rs: #1508 added a drop-instead-of-sign
  block for origin-held CacheMiss whose ENTIRE rationale was avoiding
  phantom-announcement evidence. With phantom retired and ok:false inert, that
  defense is unnecessary — removed it so origin-held CacheMiss signs like every
  other refusal. Blacklisted hashes still route to ChainHashDenied via the
  refuses() guard.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.

2 participants