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

error-index is slow to load and shows docs for wrong item while loading #100736

Closed
jsha opened this issue Aug 19, 2022 · 1 comment · Fixed by #100922
Closed

error-index is slow to load and shows docs for wrong item while loading #100736

jsha opened this issue Aug 19, 2022 · 1 comment · Fixed by #100922
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@jsha
Copy link
Contributor

jsha commented Aug 19, 2022

Steps to reproduce:

  1. In an IDE using rust-analyzer, write code with an error
  2. In the resulting error message, click the link for more details of the error message.

Expected result:

Page shows the appropriate error message.

Actual result:

Page briefly shows E0001 while loading, then jumps to the correct error message:

image

This is because the error index has gotten quite large. The highest error code is E0788. The total page size is 1.5 MB. The number of DOM elements is 29,342 (browser engineers recommend < 1,500).

We should generate a separate page for each error message, and start linking to that, while still generating error-index.md so links from older tooling remain valid and up-to-date.

This may also help those individual pages rank more highly when someone searches for error text. Right now the page is so large that search engines don't consider it a good match even when someone searches for exact text of a specific error message.

@jsha jsha added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Aug 19, 2022
@GuillaumeGomez
Copy link
Member

Taking a look.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 24, 2022
…, r=notriddle

Rewrite error index generator to greatly reduce the size of the pages

Fixes rust-lang#100736.

Instead of having all error codes in a same page (making the DOM way too big), I split the output into multiple files and generated a list of links (if there is an explanation) to the error codes' explanation into the already existing file.

I also used this opportunity to greatly simplify the code. Instead of needing a `build.rs`, I simply imported the file we want and wrote the macro which generates a function containing everything we need. We just need to call it to get the error codes and their explanation (if any). Also, considering the implementations between markdown and HTML formats differed even further, the `Formatter` trait was becoming too problematic so I removed it too.

You can test it [here](https://rustdoc.crud.net/imperio/rewrite-error-index/error-index.html).

cc `@jsha`
r? `@notriddle`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 24, 2022
…, r=notriddle

Rewrite error index generator to greatly reduce the size of the pages

Fixes rust-lang#100736.

Instead of having all error codes in a same page (making the DOM way too big), I split the output into multiple files and generated a list of links (if there is an explanation) to the error codes' explanation into the already existing file.

I also used this opportunity to greatly simplify the code. Instead of needing a `build.rs`, I simply imported the file we want and wrote the macro which generates a function containing everything we need. We just need to call it to get the error codes and their explanation (if any). Also, considering the implementations between markdown and HTML formats differed even further, the `Formatter` trait was becoming too problematic so I removed it too.

You can test it [here](https://rustdoc.crud.net/imperio/rewrite-error-index/error-index.html).

cc ``@jsha``
r? ``@notriddle``
workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
…ddle

Rewrite error index generator to greatly reduce the size of the pages

Fixes rust-lang/rust#100736.

Instead of having all error codes in a same page (making the DOM way too big), I split the output into multiple files and generated a list of links (if there is an explanation) to the error codes' explanation into the already existing file.

I also used this opportunity to greatly simplify the code. Instead of needing a `build.rs`, I simply imported the file we want and wrote the macro which generates a function containing everything we need. We just need to call it to get the error codes and their explanation (if any). Also, considering the implementations between markdown and HTML formats differed even further, the `Formatter` trait was becoming too problematic so I removed it too.

You can test it [here](https://rustdoc.crud.net/imperio/rewrite-error-index/error-index.html).

cc ``@jsha``
r? ``@notriddle``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants