]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
Reduce right-side DOM size

This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time.

So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node.

On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results:

| file name | before this PR | with this PR | diff |
|-|-|-|-|
| std/default/trait.Default.html | 2189 | 1331 | 39.2% |
| std/vec/struct.Vec.html | 14073 | 13842 | 1.7% |
| std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% |
| std/ops/trait.Index.html | 642 | 630 | 1.9% |
| gtk4/WidgetExt | 3269 | 3061 | 6.4% |

You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html).

r? `@notriddle`

1  2 
src/librustdoc/html/static/css/themes/ayu.css