Skip to content

perf(build): rust-lld linker on Windows + opt-3 deps in dev profile#3

Merged
zackees merged 1 commit into
mainfrom
perf/dev-profile-and-rust-lld
Jun 22, 2026
Merged

perf(build): rust-lld linker on Windows + opt-3 deps in dev profile#3
zackees merged 1 commit into
mainfrom
perf/dev-profile-and-rust-lld

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Two cargo-config knobs ported from fbuild#744 that collapse the local Rust-edit iteration loop with no release-build regression.

  1. [profile.dev.package."*"] opt-level = 3 in Cargo.toml — keeps third-party deps release-grade in the dev profile, so defaulting to dev for local iteration stays runtime-safe.
  2. [target.{x86_64,aarch64}-pc-windows-msvc] linker = "rust-lld.exe" in .cargo/config.toml — rust-lld ships with the toolchain, no install, 2–5× faster than MSVC's link.exe on link-heavy rebuilds. POSIX builds keep their platform default.

Test plan

  • cargo build -p template-cli succeeds with both changes in place.
  • CI green on Linux + macOS + Windows (linker change is Windows-only; profile change affects all targets but is dep-cached).

Refs #2 — items (2) + (3).

🤖 Generated with Claude Code

… items 2+3)

Two cargo-config knobs ported from FastLED/fbuild#744 that together
collapse the local Rust-edit iteration loop without any release-build
regression:

1. `[profile.dev.package."*"] opt-level = 3` in Cargo.toml. Cargo
   compiles each upstream crate once and caches the opt-level-3
   artifact, so runtime hot paths (pyo3, serde, etc.) stay at
   release-grade perf while first-party crates compile unoptimized for
   fast iteration. This is what makes "default to dev for local
   iteration" safe for downstream consumers; without it, defaulting to
   dev silently regresses runtime perf.

2. `[target.{x86_64,aarch64}-pc-windows-msvc] linker = "rust-lld.exe"`
   in .cargo/config.toml. rust-lld ships with the Rust toolchain (no
   extra install) and links 2-5x faster than MSVC's link.exe on
   link-heavy rebuilds. Escape hatch: RUSTFLAGS="-C linker=link.exe"
   for the rare case rust-lld trips on a foreign object file. POSIX
   builds keep their platform default linker.

Verified `cargo build -p template-cli` succeeds with both changes in
place. fbuild measured ~5x faster Rust-edit rebuild from this pair of
changes on its workspace; will be smaller here because the template's
dep tree is tiny, but the proportional win scales with downstream
consumers as they grow.

Refs #2 (items 2 + 3).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees zackees merged commit 17ae373 into main Jun 22, 2026
7 of 8 checks passed
@zackees zackees deleted the perf/dev-profile-and-rust-lld branch June 22, 2026 05:59
zackees added a commit that referenced this pull request Jun 22, 2026
…tem 9) (#8)

Mirrors fbuild's FBUILD_BUILD_RELEASE=1 opt-in pattern but inverted:
release is the default (CI / release wheels are the dominant path
through ci/build_wheel.py and must ship optimized binaries), and
`BUILD_PROFILE=dev` (or `=debug`) opts into the dev profile for local
iteration.

Combined with the dev-profile knobs from PR #3 (`[profile.dev.package."*"]
opt-level = 3` + rust-lld linker), this is the biggest single unlock
for the Rust-edit → wheel round trip on the local dev loop.

What changes when BUILD_PROFILE=dev:
- cargo invocation drops `--release`
- maturin invocation drops `--release`
- cache-skip + filesystem-search probe `target/debug/` instead of
  `target/release/`

Refs #2 (item 9).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant