`cargo doc` in large workspace is 10 times slower on nightly
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
- Checkout https://github.com/madsmtm/objc2/tree/815219f441c2f6a67a6787429e4460a43a66c7ff (don't forget to load git submodule
generated). - Run
cargo +nightly-2025-08-19 doc --workspace --target aarch64-apple-darwin. - Notice that it finishes in 1-2 minutes.
- Run
cargo +nightly-2025-08-20 doc --workspace --target aarch64-apple-darwin - You don't wanna wait for it to finish.
Logs from my CI on ubuntu-latest:
- On
nightly-2025-04-11(cargo doctakes ~2 mins) - On
nightly-2025-08-24(cargo doctakes ~24 mins)
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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