Skip to content
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

Template optimizations on version listing #493

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

agjohnson
Copy link
Contributor

@agjohnson agjohnson commented Sep 23, 2024

Along with a model prefetch change in the view, this reduces the number of
queries by 90 queries, from 132 to 42. This:

  • Uses prefetch build provided by last_build/latest_build to avoid multiple lookups on Version.build
  • Relies on usage of a prefetched project on Version to reduce extra project queries
  • Swaps some permission check logic to only perform additional user queries on private versions
  • Passes a project object into the build chip to avoid a lookup on Build.project.*

Along with a model prefetch change in the view, this reduces the number
of queries by 90 queries, from 132 to 42. This:

- Uses prefetchs build for `latest_build` to avoid multiple lookups on `Version.build`
- Retains usage of a prefetched `project` on Version
- Swaps some permission check logic to only perform additional user queries on private versions
- Passes a project object into the build chip to avoid a lookup on `Build.project.*`

- Refs #61
- Fixes #463
@agjohnson agjohnson requested a review from a team as a code owner September 23, 2024 21:54
@agjohnson agjohnson requested review from a team and humitos September 23, 2024 22:00
agjohnson added a commit to readthedocs/readthedocs.org that referenced this pull request Sep 23, 2024
This optimizes the version listing view and removes redundant queries.

- Requires readthedocs/ext-theme#493
- Fixes readthedocs/ext-theme#463
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Lots of linting changes, but the code changes seem pretty straightforward.

@humitos humitos merged commit a906436 into main Sep 25, 2024
4 checks passed
@humitos humitos deleted the agj/version-list-optimizations branch September 25, 2024 10:24
humitos pushed a commit to readthedocs/readthedocs.org that referenced this pull request Sep 25, 2024
This optimizes the version listing view and removes redundant queries.

- Requires readthedocs/ext-theme#493
- Fixes readthedocs/ext-theme#463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Projects: new regression on project listing response time
3 participants