Reduce queries in user profile page
What does this MR do and why?
The need for this change is best explained using the screenshot:
Here I have used /contributed
page as an example, but this applies to the other pages in the sidebar too.
We don't need to load any data on the .html
version of these endpoints, as the data to be displayed is obtained by making a different call via AJAX to the .json
endpoints.
Currently, we are loading data on both the .html
and .json
calls, which is not needed. We can just render 'show'
for the html version as it is only used to render the sidebar navigation. In this MR, we only load data specifically for the .json
calls, thereby reducing the number of queries fired on loading the .html
version of the page.
Impact
html endpoint | Number of queries fired before the change | Number of queries fired after the change |
---|---|---|
/groups | 35 | 28 |
/contributed | 39 | 28 |
/personal | 33 | 28 |
/starred | 34 | 28 |
/snippets | 32 | 28 |
/followers | 29 | 28 |
/following | 29 | 28 |
- above data was obtained manually from the performance-bar on my local dev environment.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.