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

perf: speed up user profile page #17269

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

miketheman
Copy link
Member

For users with a large amount of projects, the template iteration through
projects to fetch their latest release details turns into an n+1
query, and can time out on larger user profile pages.

Refactor the query to perform most of the logic to fetch only the data
necessary to render the template correctly, removing the need to load
full entities.

Signed-off-by: Mike Fiedler miketheman@gmail.com

@miketheman miketheman added HTML requires change to HTML files bug 🐛 labels Dec 11, 2024
@miketheman miketheman requested a review from a team as a code owner December 11, 2024 21:25
@miketheman
Copy link
Member Author

From a local dev, largest user is OCA (similar to prod), with only 193 projects, the results are demonstrative.

Before:
Screenshot 2024-12-11 at 16 06 51

After:
Screenshot 2024-12-11 at 16 20 25

@miketheman miketheman force-pushed the miketheman/query-improvement branch from a63e54a to 1e30096 Compare December 11, 2024 21:43
For users with a large amount of projects, the template iteration through
`projects` to fetch their latest `release` details turns into an n+1
query, and can time out on larger user profile pages.

Refactor the query to perform most of the logic to fetch only the data
necessary to render the template correctly, removing the need to load
full entities.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman force-pushed the miketheman/query-improvement branch from 1e30096 to 058d716 Compare December 11, 2024 21:49
@ewdurbin ewdurbin merged commit 8488a4b into pypi:main Dec 11, 2024
20 checks passed
@miketheman miketheman deleted the miketheman/query-improvement branch December 11, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 HTML requires change to HTML files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants