Skip to content

rustdoc: dedup search form HTML #124738

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

Merged
merged 2 commits into from
May 7, 2024

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented May 5, 2024

This change constructs the search form HTML using JavaScript, instead of plain HTML. It uses a custom element because

  • the parser's insert algorithm runs the connected callback synchronously, so we won't get layout jank
  • it requires very little HTML, so it's a real win in size

This shrinks the standard library by about 60MiB, by my test.

There should be no visible changes. Just use less disk space.

@rustbot
Copy link
Collaborator

rustbot commented May 5, 2024

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 5, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 5, 2024

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

Some changes occurred in GUI tests.

cc @GuillaumeGomez

@notriddle notriddle force-pushed the notriddle/search-form-js branch from 83945b8 to 3b8a5f9 Compare May 5, 2024 05:39
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/search-form-js branch from 3b8a5f9 to a6cb0b9 Compare May 5, 2024 05:44
@rust-log-analyzer

This comment has been minimized.

This change constructs the search form HTML using JavaScript, instead of plain HTML. It uses a custom element because

- the [parser]'s insert algorithm runs the connected callback synchronously, so we won't get layout jank
- it requires very little HTML, so it's a real win in size

[parser]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token

This shrinks the standard library by about 60MiB, by my test.
@notriddle notriddle force-pushed the notriddle/search-form-js branch from a6cb0b9 to eeb59f1 Compare May 5, 2024 15:15
@notriddle notriddle requested a review from GuillaumeGomez May 6, 2024 13:13
</nav>`;
}
}
window.customElements.define("rustdoc-search", RustdocSearchElement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know you could do that. Pretty nice!

@GuillaumeGomez
Copy link
Member

Nice improvement, thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 6, 2024

📌 Commit eeb59f1 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2024
@bors
Copy link
Collaborator

bors commented May 7, 2024

⌛ Testing commit eeb59f1 with merge 69e9dac...

@bors
Copy link
Collaborator

bors commented May 7, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 7, 2024
@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor Author

Failed to push the docker image.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2024
@bors
Copy link
Collaborator

bors commented May 7, 2024

⌛ Testing commit eeb59f1 with merge ce7bf27...

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 7, 2024
@notriddle
Copy link
Contributor Author

@bors r=GuillaumeGomez

Allow custom element in HTML5 tidy.

@bors
Copy link
Collaborator

bors commented May 7, 2024

📌 Commit 9262816 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2024
@bors
Copy link
Collaborator

bors commented May 7, 2024

⌛ Testing commit 9262816 with merge 5ed7a94...

@rust-log-analyzer
Copy link
Collaborator

The job dist-apple-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Collaborator

bors commented May 7, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 7, 2024
@notriddle
Copy link
Contributor Author

@bors retry

DNS…

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2024
@bors bors merged commit 7af9ad1 into rust-lang:master May 7, 2024
6 of 7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 7, 2024
@notriddle notriddle deleted the notriddle/search-form-js branch May 7, 2024 19:54
@notriddle
Copy link
Contributor Author

https://perf.rust-lang.org/compare.html?start=0f40f14b61430792cc0ea316f424685041e8443e&end=b923ea4924fede68af127ac1857dcb0382e4caf9&stat=size%3Adoc_bytes

Reduces libc doc bytes by about 9%.

@workingjubilee
Copy link
Member

homu still thinks this is in queue for some reason, so trying to talk some reason into it:

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants