Skip to content

ci: build without LTO in the build matrix - #1761

Merged
lukasIO merged 2 commits into
mainfrom
claude/ci-builds-no-lto
Dec 2, 2026
Merged

lukasIO merged 2 commits into
mainfrom
claude/ci-builds-no-lto

Conversation

@lukasIO

@lukasIO lukasIO commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

The build stage of CI is 42% of its compute: 11 jobs of 12 to 22 minutes each, in the median of 90 runs. builds.yml runs cargo build --release --workspace. The release profile has lto = true and codegen-units = 1. The workspace links 23 binaries and 3 native libraries. Each one runs a full LTO link in each job, and no cache can keep that step.

LTO is one part of the cost, not the main part. The first run of this PR was about 14% faster in the build jobs (see "Measured"). The larger part is the cold compile of the dependencies, which #1760 addresses.

Change

builds.yml sets two environment variables for its builds:

  • CARGO_PROFILE_RELEASE_LTO=false
  • CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16

The rest of the release profile stays: opt-level = "z", panic = "abort" and strip. Cargo.toml does not change, so a release still uses the full profile.

The values are the same for a PR and for main. A PR can then use the sccache objects that the runs on main save.

What the build stage no longer covers: a failure that only a full LTO link shows. ffi-builds.yml builds livekit-ffi with the profile as it ships, for the same 11 targets, on each push to main and for a release. Such a failure therefore shows after the merge, not on the PR. The example binaries get no LTO build in CI.

Measured

One run of this PR, 46626662268, with a cold cache, against the median of 90 earlier runs.

Build job Before This run
aarch64-apple-ios-sim 21.6 min 14.7 min
aarch64-pc-windows-msvc 17.7 13.0
x86_64-unknown-linux-gnu 14.6 12.3
aarch64-apple-darwin 20.4 17.4
x86_64-apple-darwin 18.4 16.2
x86_64-linux-android 14.1 12.4
aarch64-unknown-linux-gnu 11.7 10.9
aarch64-apple-ios 21.7 20.4
x86_64-pc-windows-msvc 20.0 19.1
aarch64-linux-android 14.3 14.3

The sum of these 10 jobs is 151 minutes, and it was 175. This is one run, so the numbers have noise.

The eleventh job, armv7-linux-androideabi, took 59 minutes. Its driver install step took 50 of them. Its build took 7. That step is not part of this change.

Verified

  • The compiler flags of a local cargo build --release -v, with and without the two variables. Without them: -C linker-plugin-lto -C codegen-units=1. With them: -C embed-bitcode=no -C codegen-units=16. The flags for opt-level, panic and strip are the same in both.
  • actionlint passes on builds.yml.
  • The CI run of this PR passed with the new setting on each of the 11 targets.

Not done yet

🤖 Generated with Claude Code

builds.yml runs `cargo build --release --workspace` for 11 targets. The
release profile has `lto = true` and `codegen-units = 1`, so each of
about 20 example binaries ran a full LTO link in each job. No cache can
keep that step. The build stage was 42% of the CI compute.

Two environment variables turn LTO off and set 16 codegen units for
these builds. The rest of the release profile stays. ffi-builds.yml
still builds livekit-ffi with the profile as it ships, on each push to
main and for a release.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@lukasIO
lukasIO requested a review from ladvoc as a code owner December 1, 2026 10:26
@lukasIO lukasIO added the internal to tag changes that don't require changelog documentation label Dec 1, 2026
@lukasIO lukasIO self-assigned this Dec 1, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@ladvoc ladvoc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM ✅

@lukasIO
lukasIO merged commit a765cd5 into main Dec 2, 2026
36 checks passed
@lukasIO
lukasIO deleted the claude/ci-builds-no-lto branch December 2, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal to tag changes that don't require changelog documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants