You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/.cargo
zijiren e368ec943c
perf(build): use lld on Linux and document solver/thread tuning (#477)
Stacks on #476 (same `ci.yml` regions are touched); merge after it or
rebase.

Motivation: rust-lang/rust#161748 (next-solver memory blowup) and
bevyengine/bevy#25512 (fix by avoiding deep structural auto-trait
resolution). This PR applies the applicable parts to SyncTV's build with
fresh measurements, and documents the deliberate non-changes.

## Measurements (nightly-2026-09-27, `cargo check -p synctv-api-http
--all-targets`, isolated recheck, 10-core arm64)

| Configuration | Wall | Peak rustc RSS |
| --- | --- | --- |
| `-Znext-solver=coherence` + `-Zthreads=8` (current) | 32 s | 3.8 GB |
| `-Znext-solver=coherence` + `-Zthreads=1` | 53 s | 2.8 GB |
| `-Znext-solver=globally` + `-Zthreads=8` | 37 s | **14.9 GB** |

- The #161748 regression **persists on current nightlies**: the
globally-enabled next solver still needs ~4x the peak memory on
`synctv-api-http` — beyond a 16 GB CI runner. Keeping
`-Znext-solver=coherence` is validated, now with numbers in the config
comment.
- `-Zthreads=8` is a good trade: 40% faster than 1 thread for +0.9 GB
peak. Kept, documented.
- Cold dev builds (`CARGO_TARGET_DIR` isolated, full dep graph): LLVM
**660 s / 7.7 GB** vs cranelift **671 s / 7.4 GB** → a cranelift dev
backend brings no win here (rustc frontend dominates this workspace), so
it is **not** introduced.

## Changes

- `.cargo/config.toml`: Linux gnu targets (x86_64 + aarch64) now link
with **lld** and keep `-z pack-relative-relocs`, replacing the ad-hoc
flags the Docker builder passed. `nextest` test binaries and `make
build-workspace` in CI now link with parallel lld instead of
single-threaded bfd. Target-specific rustflags replace
`build.rustflags`, so the nightly solver/thread flags are repeated in
the Linux tables and documented once in `[build]`.
- CI installs the `lld` package on every Linux job.
- `Dockerfile`: the duplicated `-Clink-arg` flags are removed (config
provides them).
- `CONTRIBUTING.md`: local Linux builds now note the `lld` package.
- Not done (deliberately): a bevy#25512-style code change (eager/manual
`Send`/`Sync` impls to shorten auto-trait chains). With coherence
enabled the heaviest crate peaks at 3.8 GB, well inside CI budgets, so
the invasive rewrite buys nothing today; the measured numbers above make
that call explicit.

## Validation

- `SQLX_OFFLINE=true cargo check -p synctv-api-http` passes with the new
config (non-Linux hosts keep the original rustflags — target tables only
match Linux).
- `cargo fmt --check` clean. The `cross-*` Makefile targets run
check/clippy only, so cross containers never invoke the linker and do
not need lld.
4 weeks ago
..
audit.toml
…
config.toml perf(build): use lld on Linux and document solver/thread tuning (#477) 4 weeks ago