Description
In doing some perf debugging on something else, I added eprintln output here:
rust/src/librustdoc/clean/types.rs
Line 462 in 63fdb82
And was surprised to find that for the stm32f4 crate, building with a single feature enabled, that line of code was hit 16,000,000 times even though only 4,000 documentation pages were being generated.
It turns out that the blanket impl for Into<U> for T where U: From<T>
uses an intra-doc link:
rust/library/core/src/convert/mod.rs
Line 724 in 63fdb82
So apparently that link gets inserted into the intra_doc_links: FxHashMap<ItemId, Vec<clean::ItemLink>>
multiple times, once for each page (since every page includes this blanket impl); and then each time links()
is called, it iterates through all 4,000 entries.