perf(build): rust-lld linker on Windows + opt-3 deps in dev profile#3
Merged
Conversation
… 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>
4 tasks
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>
10 tasks
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.
Summary
Two cargo-config knobs ported from fbuild#744 that collapse the local Rust-edit iteration loop with no release-build regression.
[profile.dev.package."*"] opt-level = 3inCargo.toml— keeps third-party deps release-grade in the dev profile, so defaulting to dev for local iteration stays runtime-safe.[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'slink.exeon link-heavy rebuilds. POSIX builds keep their platform default.Test plan
cargo build -p template-clisucceeds with both changes in place.Refs #2 — items (2) + (3).
🤖 Generated with Claude Code