Skip to content

Parallel rustc spends a lot of time creating threads #64752

Open
@alexcrichton

Description

@alexcrichton

After some discussion on zulip it looks like rayon will immediately spawn all threads for the thread pool on startup, but this isn't neessarily suitable for rustc's use case. In a profile I captured of compiling Cargo the first set of crates being compiled spent a huge amount of time just spawning threads.

I ran perf at the start of cargo build and killed it after a second or so, and the profile output of this (cleaned up) aggregated across all builds was:

Capture

I think that roughly means that 80% of the cpu time was spent transitively spawning threads/processes near the start of the build, and that seems a bit excessive!

cc @Mark-Simulacrum @Zoxc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parallel-compilerArea: parallel compilerC-enhancementCategory: An issue proposing an enhancement or a PR with one.I-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