Make diffs requests and rendering smarter (and faster) for commit page
After some discussion on https://gitlab.com/gitlab-org/gitlab-ce/issues/52396 we noticed a few interesting things that could be improved on the way we fetch diffs on GitLab today.
Problem to solve
In a high-level vision, that's how we fetch and present diffs today:
- Make the initial load of the HTML page containing no diff content
- Request the whole diff data async in one go
- Present a spinner until everything is ready to be rendered
The major problem here is that if we have a huge amount of content to load, it will take a lot of time (and even timeout in a few scenarios). Perceived performance is not good for the user.
How to improve
Ideally, that's what it should look like:
- Make the initial load of the HTML page containing at least 2 diff files (what the user will see right away)
- Batch the upcoming diff files request (no need for parallel requests here, we can do it sequentially)
That's how the requests looks like on Github now:
Technical bits
-
DiffStats
RPC request is already separate from diff content request, which is good, since we can present this data right away -
CommitDelta
Gitaly RPC already can receiveleft
andright
SHAs, therefore the client (GitLab) can be smarter about how to send these requests -
CommitDelta
RPC would likely need acutoff
argument that would work as a pagination (sort of) strategy
Status
-
Initial investigation to scope out the problem and propose a solution - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28614 -
Waiting for https://gitlab.com/gitlab-org/gitlab-ce/issues/52499#note_177711869
Edited by Mayra Cabrera