Uh oh!
There was an error while loading. Please reload this page.
Add some timing info to rustdoc - #74590
Conversation
Mark-Simulacrum
commented
Jul 21, 2020
Do we have some idea where the unknown is coming from? The time spent in it seems to have ... gone up? |
jyn514
commented
Jul 21, 2020
@Mark-Simulacrum the overall time went up as well, I think because of one of the regressions in https://github.com/rust-lang/rustc-perf/blob/master/triage/2020-07-21.md. I would look at the percentages instead. |
I'm not sure where the |
bors
commented
Aug 6, 2020
☔ The latest upstream changes (presumably #75008) made this pull request unmergeable. Please resolve the merge conflicts. |
eddyb
commented
Aug 16, 2020
@jyn514 You don't need to wrap the entirety of rustdoc, just the outermost thing that has access to a timer/profiler. r? @Mark-Simulacrum or @wesleywiser |
There was a problem hiding this comment.
Note: not a bad change, but would not have been marked as <unknown> before (it would show up as part of typeck).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eddyb
commented
Aug 16, 2020
At the very least, it looks like the entirety of |
Addressed review comments. I separated the enormous closure into a separate function, so best to view with whitespace changes disabled. Building rustdoc now to see if that got rid of most of the |
Timing the global context didn't seem to help much. |
jyn514
commented
Aug 16, 2020
I did find this comment though: rust/src/librustc_codegen_ssa/base.rs Lines 782 to 792 in 62cf767 |
jyn514
commented
Aug 16, 2020
Aha, I think I found the issue: all of the html rendering isn't timed. Lines 525 to 533 in 1d69e3b |
Well, that helped a little. |
It's coming from |
jyn514
commented
Aug 16, 2020
Anyone know why this might be getting the timing name reset? tcx.sess.time("item_types_checking", || {for&module in tcx.hir().krate().modules.keys(){
tcx.sess.time("check_mod_item_types", || {
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));});}});
|
Uh oh!
There was an error while loading. Please reload this page.
Mark-Simulacrum
commented
Aug 18, 2020
I would personally like us to track down the problem with unknown timing before merging this in, though I don't have great ideas for doing that. Maybe @wesleywiser has suggestions? |
bors
commented
Aug 24, 2020
☔ The latest upstream changes (presumably #74489) made this pull request unmergeable. Please resolve the merge conflicts. |
jyn514
commented
Aug 24, 2020
@Mark-Simulacrum I don't expect to have time to debug this soon ... are you okay with merging the current changes and opening an issue for the |
There are various improvements, but the main one is to time each pass that rustdoc performs (`rustdoc::passes`). Before, these were the top five timings for `cargo doc` on the cargo repository: ``` +---------------------------------+-----------+-----------------+----------+------------+ | Item | Self time | % of total time | Time | Item count | +---------------------------------+-----------+-----------------+----------+------------+ | <unknown> | 854.70ms | 20.888 | 2.47s | 744823 | +---------------------------------+-----------+-----------------+----------+------------+ | expand_crate | 795.29ms | 19.436 | 848.00ms | 1 | +---------------------------------+-----------+-----------------+----------+------------+ | metadata_decode_entry | 256.73ms | 6.274 | 279.49ms | 518344 | +---------------------------------+-----------+-----------------+----------+------------+ | resolve_crate | 240.56ms | 5.879 | 242.86ms | 1 | +---------------------------------+-----------+-----------------+----------+------------+ | hir_lowering | 146.79ms | 3.587 | 146.79ms | 1 | +---------------------------------+-----------+-----------------+----------+------------+ ``` Now the timings are: ``` +---------------------------------+-----------+-----------------+----------+------------+ | Item | Self time | % of total time | Time | Item count | +---------------------------------+-----------+-----------------+----------+------------+ | <unknown> | 1.40s | 22.662 | 3.73s | 771430 | +---------------------------------+-----------+-----------------+----------+------------+ | collect-trait-impls | 1.34s | 21.672 | 2.87s | 1 | +---------------------------------+-----------+-----------------+----------+------------+ | expand_crate | 1.21s | 19.577 | 1.28s | 1 | +---------------------------------+-----------+-----------------+----------+------------+ | build extern trait impl | 704.66ms | 11.427 | 1.07s | 21893 | +---------------------------------+-----------+-----------------+----------+------------+ | metadata_decode_entry | 354.84ms | 5.754 | 391.81ms | 544919 | +---------------------------------+-----------+-----------------+----------+------------+ ```
Had to use -Xignore-whitespace-conflicts to avoid awful conflicts, but that threw off the indentation
wesleywiser
commented
Aug 24, 2020
I've only skimmed the PR but I think we should not block merging this with resolving the |
Mark-Simulacrum
commented
Aug 24, 2020
Okay, knowing that we've seen this before is indeed helpful and that convinces me that it should be fine to move ahead here. @bors r+ |
bors
commented
Aug 24, 2020
📌 Commit 6e3e74d has been approved by |
bors
commented
Aug 24, 2020
bors
commented
Aug 24, 2020
☀️ Test successful - checks-actions, checks-azure |
camelid
commented
Nov 25, 2020
You may already know this, but this seems to be the rustc code that produces the Not sure why it's happening though. |
jyn514
commented
Nov 25, 2020
That's under debuginfo, so I wouldn't expect it to be related. I did notice a while back that rustdoc doesn't include the crate name in the .events file - I think that might be because doctree passes None for the crate name? I need to test it. |
jyn514
commented
Dec 3, 2020
This was #79586. |

There are various improvements, but the main one is to time each pass
that rustdoc performs (
rustdoc::passes).Before, these were the top five timings for
cargo docon the cargorepository:
Now the timings are:
The goal is to help me debug regressions like #74518 (comment) (currently I have no idea what could have gone wrong).
r? @eddyb or @Mark-Simulacrum