Fetch the merged branches at once
What does this MR do?
Fetch the merged branches at once, instead of checking it one by one in the view. We don't cache this yet because this would already much improve the performance.
Are there points in the code the reviewer needs to double check?
Previously we could be checking with Gitaly, but with this change we would be using git
command line. Could this kill the filesystem?
Why was this MR needed?
A naive test against a particularly large repository:
begin
now = Time.now
branches.map{ |b| repository.merged_to_root_ref?(b.name) }
Time.now - now
end # 8.265830782
Around 10 times faster:
begin
now = Time.now
repository.merged_branches(branches.map(&:name))
Time.now - now
end # 0.807405397
This should make the branches page usable.
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Tests added for this feature/bug - Review
-
Has been reviewed by Backend
-
What are the relevant issue numbers?
This is a follow up from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14678#note_42548019
Edited by username-removed-423915