Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large rustdoc pages take a long time to render in a browser #57281

Closed
lilyball opened this issue Jan 2, 2019 · 4 comments
Closed

Large rustdoc pages take a long time to render in a browser #57281

lilyball opened this issue Jan 2, 2019 · 4 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@lilyball
Copy link
Contributor

lilyball commented Jan 2, 2019

Rustdoc generates pages that can be large enough that they take a long time to render in a browser. Probably the worst offender is https://doc.rust-lang.org/std/iter/trait.Iterator.html.

My expectation is the prime offender here is the list of implementations. There are a lot on this page. With all the implementations collapsed, it's 51148px tall (in my browser). With them expanded, it's 650058px tall, or about 12x the height. And it takes a long time after expanding them before I can scroll to the end of the page.

I don't know how to test the speed of rendering the page if all the implementations start off collapsed, but I'm guessing it will be significantly faster.

I can think of two approaches to take here:

  1. If there's more than a small number of implementations, start them collapsed by default. I don't know where the cutoff should be. It may also depend on the number of trait members as well (the fewer the trait members, the less "heavy" each new implementation is).
  2. Add a rustdoc setting to just collapse trait implementations by default, and enable this setting by default.

Option (2) might actually be nice in general, because when I'm looking at trait implementations I'm usually trying to find a specific one, and having them all expanded makes that harder.

@sfackler sfackler added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 2, 2019
@GuillaumeGomez
Copy link
Member

Things are collapsed by default, the problem is just that the DOM is huge. Improvements are performed on this side. Also, we're thinking about reducing the number of information provided in foreign implementations.

@ebarnard
Copy link
Contributor

@GuillaumeGomez I'm not sure that things are collapsed by default. I've just opened the latest nightly Iterator docs and and the entire list of Implementors is expanded. This is in Firefox 64 with cleared cookies and site data.

@istankovic
Copy link
Contributor

I just opened the Iterator doc page with Firefox 118.0.2 and it was pretty quick and smooth. The trait implements are collapsed by default. I also tried a couple of other big pages and did not notice any lag so I think this one could be considered resolved.

@GuillaumeGomez
Copy link
Member

Thanks for the notification. I think the issue is now solved indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants