mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 09:32:15 +00:00
fix quadratic naming of duplicate sidebar links This PR fixes quadratic naming of duplicate sidebar links as discussed in https://github.com/rust-lang/rust/issues/158174. Fixes rust-lang/rust#158174 `get_next_url` gives duplicate sidebar links with unique names but it started counting from 1 every time which makes the page quadratic. So to make it more optimal I changed that to remember the next unique number for each name making it linear per page. Also added the test at `tests/rustdoc-html/deref/sidebar-links-deref-chain.rs` ### Results | N | Instructions (before) | Instructions (after) | Time (before) | Time (after) | |-----:|----------------------:|---------------------:|--------------:|-------------:| | 200 | 5.71 B | 3.69 B | 1.20 s | 1.01 s | | 400 | 22.40 B | 9.52 B | 3.79 s | 1.98 s | | 800 | 126.83 B | 30.82 B | 19.68 s | 6.04 s | | 1600 | — | — | 118.59 s | 37.76 s | r? @GuillaumeGomez