Skip to content

Only build help popup when it's really needed - #79986

Merged
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:build-help-when-needed
Mar 20, 2021
Merged

Only build help popup when it's really needed#79986
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:build-help-when-needed

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

When working on #79985, I realized that the help popup was built even when it wasn't needed. This PR only makes the help popup to be built when required.

r? @jyn514

@rust-highfive

This comment has been minimized.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2020
@camelidcamelid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 12, 2020
@jyn514jyn514 added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Dec 12, 2020

@jyn514jyn514 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's already caching here so it doesn't do work twice: https://github.com/rust-lang/rust/blob/692ad8332eeaf5de113575ff1490a050ce7d4586/src/librustdoc/html/static/main.js#L2942. Do we need to add additional caching on top? That seems redundant (and a little prone to failure, I'm not 100% the caching logic is right).

Comment threadsrc/librustdoc/html/static/main.js Outdated
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

There's already caching here so it doesn't do work twice:

It's not caching so-to-speak. Currently it's built only when it's "needed", meaning whenever you want to show/hide the help popup. Only issue: if you want to hide the help popup, you need to check its classes, and to do so, you need to build it first, which is completely unneeded since you want to hide it anyway. This PR actually enforce to only build it when needed (so when we want to display it).

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Updated!

@jyn514

Copy link
Copy Markdown
Member

I guess my question is how much work that actually saves? The new logic is a little tricky and I'm not sure the benefit is worth it.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Put in a straightforward way, we added a check in case we wanted to hide the popup that it actually existed beforehand to not create it needlessly. And as the line diff shows, it doesn't increase the code complexity much.

@camelidcamelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 15, 2021
@JohnCSimonJohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 1, 2021
@jyn514

Copy link
Copy Markdown
Member

r? @Nemo157

@rust-highfiverust-highfive assigned Nemo157 and unassigned jyn514Feb 1, 2021
@JohnCSimonJohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 23, 2021
@crlf0710crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 13, 2021
@Nemo157

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Mar 18, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit ab154fd has been approved by Nemo157

@borsbors 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 Mar 18, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 18, 2021
…ed, r=Nemo157
Only build help popup when it's really needed
When working on rust-lang#79985, I realized that the help popup was built even when it wasn't needed. This PR only makes the help popup to be built when required.
r? `@jyn514`
@Dylan-DPC-zz

Copy link
Copy Markdown

failed in rollup

@bors r- (needs tidy)

@borsbors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 18, 2021
@borsbors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 18, 2021
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

@bors: r+ rollup

@bors

bors commented Mar 19, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit e2c70f7 has been approved by GuillaumeGomez

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 19, 2021
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Woups.

@bors: r=Nemo157

@bors

bors commented Mar 19, 2021

Copy link
Copy Markdown
Collaborator

💡 This pull request was already approved, no need to approve it again.

@bors

bors commented Mar 19, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit e2c70f7 has been approved by Nemo157

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2021
Rollup of 8 pull requests
Successful merges:
- rust-lang#79986 (Only build help popup when it's really needed)
- rust-lang#82570 (Add `as_str` method for split whitespace str iterators)
- rust-lang#83244 (Fix overflowing length in Vec<ZST> to VecDeque)
- rust-lang#83254 (Include output stream in `panic!()` documentation)
- rust-lang#83269 (Revert the second deprecation of collections::Bound)
- rust-lang#83277 (Mark early otherwise optimization unsound)
- rust-lang#83285 (Update LLVM to bring in SIMD updates for WebAssembly)
- rust-lang#83297 (Do not ICE on ty::Error as an error must already have been reported)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit ae1a2df into rust-lang:masterMar 20, 2021
@rustbotrustbot added this to the 1.52.0 milestone Mar 20, 2021
@GuillaumeGomez
GuillaumeGomez deleted the build-help-when-needed branch March 20, 2021 09:52
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant 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.

10 participants

@GuillaumeGomez@rust-highfive@jyn514@Nemo157@bors@Dylan-DPC-zz@crlf0710@JohnCSimon@camelid@rustbot