rust-lang / rust-lang/rust

`cargo doc` in large workspace is 10 times slower on nightly

Open
#146,895 53 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rustdoc-search C-bug E-needs-mcve I-compiletime P-high perf-regression regression-from-stable-to-stable S-has-bisection T-rustdoc T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

EDIT: Workaround for now is to use cargo +nightly doc -Zrustdoc-mergeable-info, see https://github.com/rust-lang/rust/issues/130676 for more info.

Reproduction Steps

Logs from my CI on ubuntu-latest:

Bisection

searched nightlies: from nightly-2025-08-19 to nightly-2025-08-20
regressed nightly: nightly-2025-08-20
searched commit range: https://github.com/rust-lang/rust/compare/9eb4a2652031ed5ba97c29ef21c79db1645f7883...05f5a58e84a9c3a68586d70bf3d7442c571e379e
regressed commit: https://github.com/rust-lang/rust/commit/8365fcb2b840c95eeb0bc377af8bd498fad22245

bisected with cargo-bisect-rustc v0.6.8

Host triple: aarch64-apple-darwin
Reproduce with:

cargo bisect-rustc --timeout 120 --start 2025-08-19 --end 2025-08-20 -- doc 

Additional Details

I'd guess this is probably from https://github.com/rust-lang/rust/pull/144476, CC @notriddle @lolbinarycat @GuillaumeGomez. I see that the regression was spotted by the perf test suite, but probably not to the degree that I'm hitting.

I tried creating a more minimal reproducer for this, but that was kinda hard, since it's a performance thing, so it only really shows up in larger cases :/.

I did try looking at Activity Monitor, it looks like often there's only a single rustdoc process consuming CPU, and only intermittently, so there might be some global locking going on? fseventsd also seemed very active, but that might be normal, idk.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the regression with the objc2 workspace and the nightly commands in the issue, then compare the regressed commit 8365fcb2 and PR 144476. Start by profiling the cargo doc and rustdoc work introduced around that change, using the mergeable-info workaround as a comparison. Done means large-workspace documentation generation no longer shows the reported nightly slowdown while retaining normal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.