Rust enables the parallel compiler frontend by default on nightly
The Rust compiler's backend has long used several threads to generate code with LLVM[1]. Its frontend, which covers type checking and borrow checking[2], has run on a single thread. In 2023 the parallel frontend became available on the nightly channel[3] as an opt-in, but it was not enabled by default, and the planned stabilization in 2024 did not happen.
In the team's benchmarks, cargo check of the nalgebra, cargo and diesel crates was almost three times faster with 8 threads, while some other benchmarks barely improved. On the cargo crate, a full cargo check took 36.7 s with one frontend thread and 30.8 s with eight, about 15% less. Incremental rebuilds improved by a mean of 3-5% in the team's benchmark suite.
Nightly now uses 2 frontend threads by default, and the count can be changed with the --jobs-frontend flag, where --jobs-frontend=1 turns the parallel frontend off. The team notes that diagnostics may appear in a non-deterministic order and that some binaries may not be reproducible, which it treats as bugs. The stable toolchain keeps the sequential frontend, and the team will watch GitHub and Zulip for reports before deciding on stabilization.
Read the original blog.rust-lang.orgDiscussion
Sources
-
blog.rust-lang.org
Enabling the parallel frontend on nightly
OriginalDiscussion · 15DiscussionDiscussionDiscussionDiscussion


