Closed
Description
I tested out a full crate build of the Cargo crate graph in release mode with a parallel rustc compiler today but it unfortunately regressed the build time relative to nightly by about 20%! The cause of the regression appears to be an enormous amount of time spent in the kernel, particularly related to jobserver management (although there's some other thread-related stuff in the profile too like waiting on cvars).
After a brief discussion on Zulip we decided to open an issue here about the jobserver strategy in general. To be clear, the current downsides that I've seen are:
- Tokens are acquired/reacquired excessively, causing most compilation time get sunk into the kernel.
- Tokens aren't managed quite right because the maximum parallelism went above the jobserver limit. My
-j28
build, for example, at one point had 45 rustc instances running.
I'm not personally too familiar with the current jobserver code in rustc, but this is something that likely warrants improvement before shipping!