Skip to content

src-script.js: make srcIndex into a parameter instead of a global variable #138467

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

Open
lolbinarycat opened this issue Mar 13, 2025 · 1 comment · May be fixed by #142100
Open

src-script.js: make srcIndex into a parameter instead of a global variable #138467

lolbinarycat opened this issue Mar 13, 2025 · 1 comment · May be fixed by #142100
Assignees
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) A-technical-debt Area: Internal cleanup work C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Comments

@lolbinarycat
Copy link
Contributor

as far as I can tell, this is only used in createSrcSidebar, which is called in generated code like this:

var srcIndex = new Map(JSON.parse('[["test123",["",[],["test123.rs"]]]]'));
createSrcSidebar();

instead, we could have generated code like this:

let srcIndex = new Map(JSON.parse('[["test123",["",[],["test123.rs"]]]]'));
createSrcSidebar(srcIndex);
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2025
@lolbinarycat lolbinarycat added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-rustdoc-ui Area: Rustdoc UI (generated HTML) A-technical-debt Area: Internal cleanup work and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 13, 2025
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Mar 13, 2025
@lolbinarycat lolbinarycat self-assigned this Mar 13, 2025
@fmease fmease added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 4, 2025
@lolbinarycat
Copy link
Contributor Author

Working on this now. This should slightly reduce rustdoc's idle memory usage because we won't have a global variable floating around holding data used for one-time initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) A-technical-debt Area: Internal cleanup work C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants