ci(windows): speed up R CMD check with dev profile, lld, prebuilt just#190
ci(windows): speed up R CMD check with dev profile, lld, prebuilt just#190
Conversation
… prebuilt just The Windows job's dominant cost is `* checking whether package 'miniextendr' can be installed ...` — i.e. `cargo build` + `cargo rustc --crate-type cdylib` under MinGW. Four compounding wins: - CARGO_PROFILE=dev: skip release monomorphization; keep codegen-units=1 for linkme. R CMD check doesn't exercise optimized paths. - rust-lld via -fuse-ld=lld: bypass the slow MinGW bfd linker on both staticlib and cdylib passes. - taiki-e/install-action@just: stop compiling just from source every run. - [profile.dev/release] incremental = false: deterministic rustc output so sccache hit rate approaches 100% on fresh runners. Also add `.claude/worktrees/` and `.claude/scheduled_tasks.lock` to .gitignore so agent worktrees stop showing as untracked. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ld.lld rejects zero-byte files as "unknown file type"; ld.bfd tolerated them silently. Using `ar crs` produces a real (empty) archive with the `!<arch>` magic header, which both linkers accept. This only surfaced after enabling `-fuse-ld=lld` in the previous commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Disabling incremental in [profile.*] would affect local dev loops too. Setting CARGO_INCREMENTAL=0 at the workflow env level scopes it to CI, so sccache hit rate benefits everywhere without burdening the edit/compile cycle on developer machines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b8990bf to
8a6c524
Compare
|
Windows failure root cause (from the prior run's log before rebase): Repeated across many tests — it's panic-unwinding broken at runtime, not compile/link. The three changes in this PR that could interact with unwinding are:
Suggested narrowing on the Windows box:
I've rebased onto main; push looks like it just bumped CI back into progress. |
|
Correction on the suggestion above — linker speed is the whole point of this PR, so reverting lld isn't the path. Keep lld, swap the runtime story. Best-looking fixes that keep
I'd try #1 first since it's the smallest diff to this PR. |
Summary
The Windows R CMD check job was spending nearly all of its time in the step
after `* checking serialization versions ... OK` — that is `checkingLog(Log,
"whether package 'miniextendr' can be installed")` (see
`r-svn/src/library/tools/R/check.R:5952`), which shells out to `R CMD INSTALL`
and ultimately runs `cargo build` + `cargo rustc --crate-type cdylib` through
MinGW.
Four compounding speedups on the Windows job:
LLVM codegen that R CMD check never exercises. Dev still keeps
`codegen-units = 1` (required for linkme `distributed_slice` in the user
crate).
`ld.bfd` is the single slowest step in the install phase on Windows.
rust-lld is shipped with the rustup toolchain and satisfies
`-fuse-ld=lld` via the host gcc. Applies to both the staticlib and cdylib
link passes.
the prebuilt action; Windows was uniquely compiling `just` from source
every run via `cargo install just`.
sccache note already in `CLAUDE.md`, incremental compilation writes
per-invocation unique hashes that poison the sccache cache key. Turning it
off makes rustc output deterministic so sccache hit rate approaches 100% on
the fresh CI runner.
Plus a small hygiene fix: `.claude/worktrees/` and `.claude/scheduled_tasks.lock`
are now properly gitignored instead of showing up as untracked every session.
Risk
The lld linker flag is the only change with non-trivial risk: if Rtools45's
bundled gcc can't resolve `lld` on PATH, the link step fails fast with a
clear error and we revert that one line. Everything else is independent and
safe on its own.
No workspace-crate `.rs` changes, so `inst/vendor.tar.xz` does not need
regeneration for this PR.
Test plan
Generated with Claude Code