Closed
Metadata
Metadata
Assignees
Labels
Area: Intra-doc links, the ability to link to items in docs by nameArea: Trait systemCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Issue: Problems and improvements with respect to compile times.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Activity
jyn514 commentedon Nov 5, 2020
-Z self-profile
jyn514 commentedon Nov 5, 2020
Nearly 100% of that time is spent in
get_blanket_impls
.Is this even required for intra-doc links? AFAIK this is only for
Send
andSync
, which don't have associated items.jyn514 commentedon Nov 5, 2020
... why is
InferCtxtInner::new
taking a quarter of the time?jyn514 commentedon Nov 5, 2020
I think this could be sped up quite a bit by only considering traits that have an associated item of the right name. Then rustdoc wouldn't have to go through the trait system at all, just look at it long enough to see it wouldn't work even if it did apply to the type.
jyn514 commentedon Nov 5, 2020
Relevant code:
rust/src/librustdoc/passes/collect_intra_doc_links.rs
Line 605 in b385598
rust/src/librustdoc/clean/blanket_impl.rs
Line 23 in b385598
We could change
get_blanket_impls
to take afilter
parameter, that wouldn't be too invasive I think.est31 commentedon Nov 5, 2020
It probably also doesn't help that
for_each_relevant_impl
simplifies the type to an extent where all generic args are erased and then iterates on all trait implementations of it:rust/compiler/rustc_middle/src/ty/trait_def.rs
Line 174 in 790d19c
If you have gazillions of
impl Trait for F<A1> {} .... impl Trait for F<A10000>
then that's a problem :)Reducing the number of traits this (rather expensive) search is done is a good idea!
est31 commentedon Nov 5, 2020
I think the strategy similar to #78317 (comment) would be helpful here too, but I guess the lower hanging fruit (checking whether the trait contains the name in the first place) should be tried before.
seeplusplus commentedon Nov 5, 2020
Discussed in Discord with @jyn514 , I'll be trying my hand at this one 🚀
@rustbot claim
11 remaining items