load crate menu contents on demand
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 232
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 60
Description
Most page navigations don't result in opening the crate menu. We could load that menu using JS, either immediately after page load or on click / hover.
That would simplify https://github.com/rust-lang/docs.rs/issues/1560 because a page's HTML wouldn't depend on the list of crate versions and yanked versions.
It would also, I believe, result in an improvement in performance, reducing database load and wall clock time to load rustdoc pages.
Right now, every page load invokes this JOIN query across releases, crates, doc_coverage, and repositories: https://github.com/rust-lang/docs.rs/blob/19b354ab0b910014c7bc11da811a40b19502cc87/src/web/crate_details.rs#L90-L129. If the initial page load doesn't need doc_coverage and repository info, we can reduce this to a JOIN across releases and crates.
Each page load also does a query across owners and owner_rels, which doesn't need to be done at page load time: https://github.com/rust-lang/docs.rs/blob/19b354ab0b910014c7bc11da811a40b19502cc87/src/web/crate_details.rs#L207-L213
This query in releases_for_crate, across the releases table (with no LIMIT) could also be avoided at page load time: https://github.com/rust-lang/docs.rs/blob/19b354ab0b910014c7bc11da811a40b19502cc87/src/web/crate_details.rs#L247-L260
So I think the net result would be replacing three queries (two of them using JOINs) with a single, simple query with a single result.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/web/crate_details.rs at the linked query sections and trace how crate menu contents are rendered. Compare the current page-load queries with the proposed on-demand loading and consider the relationship to issue 1560. Done means the initial page no longer requires the unnecessary menu data while the crate menu still loads with its existing contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100