-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustdoc-search: reuse individual types in function signatures #119756
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map is implemented as a pointer to a mutable object. Rustdoc never mutates function signatures after constructing them, but the JS engine doesn't know that. To save a bunch of memory, use a single immutable map for every decoded type object with no bindings or generics.
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
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
Jan 9, 2024
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This takes advantage of more reuse opportunities. Along with the empty object commit, they bringing memory usage down about 20% over the original.
notriddle
force-pushed
the
notriddle/reuse-map
branch
from
January 9, 2024 01:57
1600cc9
to
c3cd657
Compare
GuillaumeGomez
approved these changes
Jan 9, 2024
Great work, thanks! @bors r+ rollup |
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
Jan 9, 2024
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Jan 9, 2024
…uillaumeGomez rustdoc-search: reuse individual types in function signatures Because `search.js` never mutates the function signature after loading it, they can be safely and easily reused across functions. This change doesn't change the format of the search index. It only changes `search.js`. Profiler output: https://notriddle.com/rustdoc-html-demo-9/fn-signature-opti2/index.html <table><tr><th>benchmark<th>before<th>after <tr><th>arti<td> ``` user: 002.228 s sys: 000.315 s wall: 001.663 s child_RSS_high: 315668 KiB group_mem_high: 285948 KiB ``` <td> ``` user: 001.805 s sys: 000.231 s wall: 001.398 s child_RSS_high: 235864 KiB group_mem_high: 203056 KiB ``` <tr><th>cortex-m<td> ``` user: 000.143 s sys: 000.035 s wall: 000.140 s child_RSS_high: 59168 KiB group_mem_high: 23000 KiB ``` <td> ``` user: 000.138 s sys: 000.031 s wall: 000.133 s child_RSS_high: 58944 KiB group_mem_high: 22220 KiB ``` <tr><th>sqlx<td> ``` user: 000.792 s sys: 000.115 s wall: 000.536 s child_RSS_high: 156716 KiB group_mem_high: 122948 KiB ``` <td> ``` user: 000.824 s sys: 000.084 s wall: 000.535 s child_RSS_high: 136668 KiB group_mem_high: 101792 KiB ``` <tr><th>stm32f4<td> ``` user: 006.665 s sys: 003.533 s wall: 008.624 s child_RSS_high: 1037660 KiB group_mem_high: 1022516 KiB ``` <td> ``` user: 005.997 s sys: 003.185 s wall: 007.987 s child_RSS_high: 832068 KiB group_mem_high: 810908 KiB ``` <tr><th>stm32f4xx-hal<td> ``` user: 000.317 s sys: 000.051 s wall: 000.203 s child_RSS_high: 77060 KiB group_mem_high: 41776 KiB ``` <td> ``` user: 000.287 s sys: 000.046 s wall: 000.180 s child_RSS_high: 75216 KiB group_mem_high: 39200 KiB ``` <tr><th>ripgrep<td> ``` user: 000.463 s sys: 000.063 s wall: 000.295 s child_RSS_high: 101288 KiB group_mem_high: 66364 KiB ``` <td> ``` user: 000.472 s sys: 000.036 s wall: 000.247 s child_RSS_high: 82708 KiB group_mem_high: 47056 KiB ``` </tr></table>
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 9, 2024
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#117372 (Update stdarch submodule) - rust-lang#118241 (Making `User<T>` and `User<[T]>` `Send`) - rust-lang#118748 (std: getrandom simplification for freebsd.) - rust-lang#119527 (don't reexport atomic::ordering via rustc_data_structures, use std import) - rust-lang#119699 (Merge dead bb pruning and unreachable bb deduplication.) - rust-lang#119723 (Remove `-Zdont-buffer-diagnostics`.) - rust-lang#119756 (rustdoc-search: reuse individual types in function signatures) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 9, 2024
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#117556 (Disallow reference to `static mut` and adding `static_mut_ref` lint) - rust-lang#118748 (std: getrandom simplification for freebsd.) - rust-lang#119282 (Rework and improve the unstable documentation of check-cfg) - rust-lang#119527 (don't reexport atomic::ordering via rustc_data_structures, use std import) - rust-lang#119668 (Simplify implementation of MIR promotion) - rust-lang#119699 (Merge dead bb pruning and unreachable bb deduplication.) - rust-lang#119723 (Remove `-Zdont-buffer-diagnostics`.) - rust-lang#119756 (rustdoc-search: reuse individual types in function signatures) - rust-lang#119758 (GNU/Hurd: unconditionally use inline stack probes) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 9, 2024
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#117556 (Disallow reference to `static mut` and adding `static_mut_ref` lint) - rust-lang#118748 (std: getrandom simplification for freebsd.) - rust-lang#119282 (Rework and improve the unstable documentation of check-cfg) - rust-lang#119527 (don't reexport atomic::ordering via rustc_data_structures, use std import) - rust-lang#119668 (Simplify implementation of MIR promotion) - rust-lang#119699 (Merge dead bb pruning and unreachable bb deduplication.) - rust-lang#119723 (Remove `-Zdont-buffer-diagnostics`.) - rust-lang#119756 (rustdoc-search: reuse individual types in function signatures) - rust-lang#119758 (GNU/Hurd: unconditionally use inline stack probes) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 9, 2024
Rollup merge of rust-lang#119756 - notriddle:notriddle/reuse-map, r=GuillaumeGomez rustdoc-search: reuse individual types in function signatures Because `search.js` never mutates the function signature after loading it, they can be safely and easily reused across functions. This change doesn't change the format of the search index. It only changes `search.js`. Profiler output: https://notriddle.com/rustdoc-html-demo-9/fn-signature-opti2/index.html <table><tr><th>benchmark<th>before<th>after <tr><th>arti<td> ``` user: 002.228 s sys: 000.315 s wall: 001.663 s child_RSS_high: 315668 KiB group_mem_high: 285948 KiB ``` <td> ``` user: 001.805 s sys: 000.231 s wall: 001.398 s child_RSS_high: 235864 KiB group_mem_high: 203056 KiB ``` <tr><th>cortex-m<td> ``` user: 000.143 s sys: 000.035 s wall: 000.140 s child_RSS_high: 59168 KiB group_mem_high: 23000 KiB ``` <td> ``` user: 000.138 s sys: 000.031 s wall: 000.133 s child_RSS_high: 58944 KiB group_mem_high: 22220 KiB ``` <tr><th>sqlx<td> ``` user: 000.792 s sys: 000.115 s wall: 000.536 s child_RSS_high: 156716 KiB group_mem_high: 122948 KiB ``` <td> ``` user: 000.824 s sys: 000.084 s wall: 000.535 s child_RSS_high: 136668 KiB group_mem_high: 101792 KiB ``` <tr><th>stm32f4<td> ``` user: 006.665 s sys: 003.533 s wall: 008.624 s child_RSS_high: 1037660 KiB group_mem_high: 1022516 KiB ``` <td> ``` user: 005.997 s sys: 003.185 s wall: 007.987 s child_RSS_high: 832068 KiB group_mem_high: 810908 KiB ``` <tr><th>stm32f4xx-hal<td> ``` user: 000.317 s sys: 000.051 s wall: 000.203 s child_RSS_high: 77060 KiB group_mem_high: 41776 KiB ``` <td> ``` user: 000.287 s sys: 000.046 s wall: 000.180 s child_RSS_high: 75216 KiB group_mem_high: 39200 KiB ``` <tr><th>ripgrep<td> ``` user: 000.463 s sys: 000.063 s wall: 000.295 s child_RSS_high: 101288 KiB group_mem_high: 66364 KiB ``` <td> ``` user: 000.472 s sys: 000.036 s wall: 000.247 s child_RSS_high: 82708 KiB group_mem_high: 47056 KiB ``` </tr></table>
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because
search.js
never mutates the function signature after loading it,they can be safely and easily reused across functions.
This change doesn't change the format of the search index.
It only changes
search.js
.Profiler output: https://notriddle.com/rustdoc-html-demo-9/fn-signature-opti2/index.html