-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Only build help popup when it's really needed #79986
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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).
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). |
692ad83
to
ab154fd
Compare
Updated! |
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. |
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. |
r? @Nemo157 |
@bors r+ |
📌 Commit ab154fd has been approved by |
…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`
ab154fd
to
e2c70f7
Compare
@bors: r+ rollup |
📌 Commit e2c70f7 has been approved by |
Woups. @bors: r=Nemo157 |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit e2c70f7 has been approved by |
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
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