Skip to content

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:

  1. Make the initial load of the HTML page containing no diff content
  2. Request the whole diff data async in one go
  3. 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:

  1. Make the initial load of the HTML page containing at least 2 diff files (what the user will see right away)
  2. 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:

Screen_Shot_2018-10-10_at_12_05_34

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 receive left and right SHAs, therefore the client (GitLab) can be smarter about how to send these requests
  • CommitDelta RPC would likely need a cutoff argument that would work as a pagination (sort of) strategy

Status

Edited by Mayra Cabrera