Significantly cut memory and SQL queries when reloading diffs
By eliminating the need to load the diffs into memory and preloading the merge request diff, we can eliminate many N+1 queries. For a push to the staging GitLab.com www-gitlab-com repository, this eliminates over 3000 SQL queries and appears to bring down the RSS usage by several gigabytes.
Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/49703
Edited by Stan Hu