You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Don't look for blanket impls in intra-doc links [#79682](https://github.com/rust-lang/rust/pull/77700)
27
+
28
+
This PR was very disappointing to write. The gist is that if you had
29
+
30
+
```rust
31
+
traitTrait {
32
+
fnf() {}
33
+
}
34
+
35
+
impl<T> TraitforT {}
36
+
```
37
+
38
+
then linking to `usize::f` would not only not work, but would take longer to run than the rest of
39
+
intra-doc links to run. This temporarily disabled blanket impls until the bug is fixed and the performance can be improved, for a similar [90x] speedup on `stm32h7xx`.
40
+
41
+
You may be wondering why stm32h7xx was so slow before; see the end of the post for details.
With the recent growth of the rustdoc team, we finally had some time to pay the technical debt we've been accumulating for a while. To sum it up: removing implementations in rustdoc and use the compiler types directly. First, we need to explain a bit how rustdoc works. When we run it to generate HTML documentation, it goes through several steps:
@@ -24,7 +55,7 @@ With the recent growth of the rustdoc team, we finally had some time to pay the
24
55
[**@jyn514**] noticed a while ago that [most of the work in Rustdoc is duplicated](https://github.com/rust-lang/rust/issues/76382): there are actually *three* different abstract syntax trees (ASTs)! One for `doctree`, one for `clean`, and one is the original [HIR](https://rustc-dev-guide.rust-lang.org/hir.html) used by the compiler.
25
56
Rustdoc was spending quite a lot of time converting between them. Most of the speed improvements have come from getting rid of parts of the AST altogether.
26
57
27
-
### Burning down the tree
58
+
### Pruning the tree
28
59
29
60
Most of the work `doctree` did was 100% unnecessary. All the information it had was already present in the [HIR], and recursively walking the crate and building up new types took quite a while to run.
30
61
@@ -120,12 +151,25 @@ Most of the existing cleanups have been focused on calculating info on-demand th
120
151
121
152
### Speed up `collect_blanket_impls`
122
153
123
-
One of the slowest functions in all of rustdoc is a function called [`get_auto_trait_and_blanket_impls`](https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/utils/fn.get_auto_trait_and_blanket_impls.html). On crates with many blanket implementation, such as `stm32`-generated crates, this can take [almost half of the *total* time](https://github.com/rust-lang/rust/issues/79103#issuecomment-745732064) rustdoc spends on the crate.
154
+
One of the slowest functions in all of rustdoc is a function called
0 commit comments