Repository navigation
build: enable rustc parallel frontend (-Zthreads=8) for local builds - #31096
Conversation
|
Updated 4:44 PM PT - May 19th, 2026
❌ @dylan-conway, your commit 715a175 has 1 failures in
🧪 To try this PR locally: bunx bun-pr 31096That installs a local version of the PR into your bun-31096 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR conditionally enables Rust's parallel frontend compilation for local development builds. The change appends ChangesParallel Rust Frontend Optimization
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
This PR may be a duplicate of:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
LGTM — local-only build flag with clear rationale and CI gating.
Extended reasoning...
Overview
This PR adds a single conditional rustflags.push("-Zthreads=8") to scripts/build/rust.ts, gated behind !cfg.ci. It enables rustc's parallel frontend for local developer builds to speed up the critical-path crate compilation, with a detailed code comment explaining the choice of 8 threads and why CI/release builds are excluded.
Security risks
None. This is a build-script change that only adds a compiler optimization flag for local builds. It does not touch runtime code, auth, crypto, or any user-facing surface.
Level of scrutiny
Low. The change is confined to the build pipeline and explicitly excluded from CI/release via !cfg.ci, so shipped binaries are unaffected. The file already uses several nightly -Z flags (-Zsanitizer, -Zbuild-std, -Zsplit-lto-unit, -Zlocation-detail), and the toolchain is pinned to nightly per existing comments, so adding another -Z flag follows the established pattern. Worst-case failure mode is a local build error, which is easily reverted.
Other factors
The PR description includes benchmark data justifying the thread count, references the upstream compiler-team proposal that will eventually make this the default, and notes manual verification that the flag appears in local build.ninja but not under --ci=true. The change is small (one conditional push + comment), self-contained, and matches the surrounding code style. No bugs were found by the bug-hunting system.
rustc's frontend (parse, macro expansion, typeck, borrowck) is single-threaded by default — only the LLVM backend fans out via
codegen-units. The Rust crate graph's critical path is a serial chain ending inbun_runtime, so during the tail of everybun bdone core does ~20s of work while the rest idle.-Zthreads=8enables rustc's parallel-frontend query pool. It shares cargo's jobserver, so concurrent rustcs don't oversubscribe — each frontend thread acquires a-jtoken before running. Gated on!cfg.ciso PR/release builds keep deterministic diagnostic ordering and stay off the nightly-Zsurface.Why 8 and not nproc: scaling on
bun_runtime(32-core box, debug, no incremental cache):-ZthreadsReturns flatten past 8 (macro expansion is inherently serial; the query DAG has its own critical path), and
0is marginally worse than8from sharded-lock contention. 8 is also the upstream proposal for the eventual default (rust-lang/compiler-team#681), so this becomes a no-op when that lands.Verified: flag present in
build.ninjafor local configure, absent with--ci=true;bun bd --revisionworks.