-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some timing info to rustdoc #74590
Conversation
Do we have some idea where the unknown is coming from? The time spent in it seems to have ... gone up? |
@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 |
☔ The latest upstream changes (presumably #75008) made this pull request unmergeable. Please resolve the merge conflicts. |
@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 |
src/librustdoc/core.rs
Outdated
EmitIgnoredResolutionErrors::new(tcx).visit_body(body); | ||
tcx.sess.time("emit ignored resolution errors", || { | ||
EmitIgnoredResolutionErrors::new(tcx).visit_body(body); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: not a bad change, but would not have been marked as <unknown>
before (it would show up as part of typeck
).
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.
|
I did find this comment though: rust/src/librustc_codegen_ssa/base.rs Lines 782 to 792 in 62cf767
|
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 |
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));
});
}
});
|
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? |
☔ The latest upstream changes (presumably #74489) made this pull request unmergeable. Please resolve the merge conflicts. |
@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
I've only skimmed the PR but I think we should not block merging this with resolving the |
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+ |
📌 Commit 6e3e74d has been approved by |
☀️ Test successful - checks-actions, checks-azure |
You may already know this, but this seems to be the rustc code that produces the
Not sure why it's happening though. |
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. |
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 doc
on 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