Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upGreatly improve rustdoc rendering speed issues #56005
Conversation
rust-highfive
assigned
QuietMisdreavus
Nov 16, 2018
rust-highfive
added
the
S-waiting-on-review
label
Nov 16, 2018
This comment has been minimized.
This comment has been minimized.
|
I feel like this doesn't optimize the load time on my system (Chrome, Windows 7) enough to warrant displaying practically nothing while it loads. The total loss of information while it processes is way too much of a regression for not enough of a fix. I agree with @ollie27 that a better fix would be to render less information on the page to begin with, use less items that need processing, somehow make it so that the JS doesn't need to create all these elements, something like that. |
This comment has been minimized.
This comment has been minimized.
|
The problem is mostly on the DOM manipulation, not the JS execution. I can add a bit of text but I clearly prefer to wait 3 seconds rather than having a laggy page for 30 seconds. This also fixes the issue about the fact that the docs started while being expanded when it was expected that they were collapsed. |
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
2 times, most recently
from
c10321d
to
661ef14
Nov 26, 2018
This comment has been minimized.
This comment has been minimized.
|
@QuietMisdreavus Okay, I was able to make it a lot faster: Going from 13 seconds to 0.5 seconds for JS execution. I guess we're good now? |
QuietMisdreavus
reviewed
Dec 2, 2018
While i don't see the dramatic speedup you're seeing (and my Firefox's dev tools won't cooperate to let me profile the code on the Iterator page), i can at least see some speedup. This is probably fine after these comments, but i'm going to try to summon more eyes on this to make sure we fully understand the ramifications here.
src/librustdoc/html/static/main.js Outdated
src/librustdoc/html/static/main.js Outdated
src/librustdoc/html/static/main.js Outdated
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/rustdoc to get more eyes on this PR; the transformations here all look straightforward, but i'm not too familiar with JS so i'd like to get another review pass on it. I also want to ping @rust-lang/docs about what i think is the biggest problem with the PR. The idea is that by hiding everything to begin with, all the DOM changes we do to add fold-toggle elements won't trigger a bunch of repainting, speeding up the JS execution. However, this leads to the unfortunate consequence where generated docs require JavaScript to look at anything any more. Based on a totally informal and non-authoritative Twitter poll, at least some people browse the internet, including Rust docs, with JS turned off, so we will be leaving some people behind here. Whether we're okay with that, i'm not willing to call by myself. |
This comment has been minimized.
This comment has been minimized.
|
I'm pretty strongly of the opinion that we should support noscript browsers or users who run with JS disabled, unless and until someone demonstrates that there is no value to it. |
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
dc8d89a
to
d0236bd
Dec 2, 2018
This comment has been minimized.
This comment has been minimized.
The issue here is not that it doesn't have value. It certainly does. The issue is that if it has too much downside. We already make a number of choices, historically, that harm the average user, in order to support this use-case. The question isn't about value, it's about balancing the pros and cons of different approaches that have different values. |
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
a5387b7
to
9347839
Dec 2, 2018
This comment has been minimized.
This comment has been minimized.
|
After some discussion on Discord, we've added a couple new features to this:
This at least provides some notice to the user that the page is taking extra time to process. For the most part, this only shows up on pages with tons of content like Now that it has these changes, this PR looks good to me. Would like to see what the others (and travis) think before i r+ though. |
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
9347839
to
5d8da21
Dec 3, 2018
This comment has been minimized.
This comment has been minimized.
|
|
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
5d8da21
to
bd9b981
Dec 4, 2018
This comment has been minimized.
This comment has been minimized.
|
Rebased. |
GuillaumeGomez
referenced this pull request
Dec 5, 2018
Merged
Added a bare-bones eslint config (removing jslint) #56523
This comment has been minimized.
This comment has been minimized.
|
|
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
bd9b981
to
d21e658
Dec 6, 2018
This comment has been minimized.
This comment has been minimized.
|
Rebased. |
This comment has been minimized.
This comment has been minimized.
|
|
GuillaumeGomez
added some commits
Nov 16, 2018
GuillaumeGomez
force-pushed the
GuillaumeGomez:speedup-doc-render
branch
from
d21e658
to
b8c1726
Dec 6, 2018
GuillaumeGomez
referenced this pull request
Dec 8, 2018
Open
search-index.js slows down documentation browsing #56545
This comment has been minimized.
This comment has been minimized.
|
@QuietMisdreavus travis is happy and we are getting new issues about this. Do you want to wait a bit longer or do you think it's ready to go? |
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/rustdoc @rust-lang/docs to take another look. Does the new support of NoScript users and the new "loading" message make this PR mergeable? |
| @@ -23,6 +23,9 @@ pub static RUSTDOC_CSS: &'static str = include_str!("static/rustdoc.css"); | |||
| /// The file contents of `settings.css`, responsible for the items on the settings page. | |||
| pub static SETTINGS_CSS: &'static str = include_str!("static/settings.css"); | |||
|
|
|||
| /// The file contents of the `noscript.css` file, used in case JS isn't supported or is disabled. | |||
| pub static NOSCRIPT_CSS: &'static str = include_str!("static/noscript.css"); | |||
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Dec 10, 2018
Member
Just realized: New static file, need to update docs.rs when this is merged.
This comment has been minimized.
This comment has been minimized.
|
Given the rousing lack of comment, i'm going to go ahead and push this one out. @bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-review
labels
Dec 14, 2018
QuietMisdreavus
referenced this pull request
Dec 14, 2018
Open
changes required in future nightlies #270
This comment has been minimized.
This comment has been minimized.
added a commit
that referenced
this pull request
Dec 15, 2018
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-review
and removed
S-waiting-on-bors
labels
Dec 15, 2018
This comment has been minimized.
This comment has been minimized.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment has been minimized.
This comment has been minimized.
@bors retry |
bors
added
S-waiting-on-bors
and removed
S-waiting-on-review
labels
Dec 15, 2018
This comment has been minimized.
This comment has been minimized.
added a commit
that referenced
this pull request
Dec 15, 2018
This comment has been minimized.
This comment has been minimized.
|
|

GuillaumeGomez commentedNov 16, 2018
•
edited
Fixes #55900.
So a few improvements here:
DOMTokenListAPI when available providing a replacement if it isn't (should only happen on safari and IE I think...)r? @QuietMisdreavus