Skip to content

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

Closed
@lilyball

Description

@lilyball

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions