Skip to content

Parallel compiler jobserver management strategy #64750

Closed
@alexcrichton

Description

@alexcrichton

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!

cc @Mark-Simulacrum @Zoxc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parallel-compilerArea: parallel compilerI-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions