summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-13 13:50:27 -0700
committerStan Hu <stanhu@gmail.com>2019-06-13 13:56:54 -0700
commit89fa253864442096b7cf5bb5803f6b103aa0d92e (patch)
treea7cd0909e1853b96ec4c52974920ec725653a2c2
parent21bf85553d257f0e1d80e63931ef7585c2afdae6 (diff)
downloadgitlab-ce-89fa253864442096b7cf5bb5803f6b103aa0d92e.tar.gz
Speed up merge request loads by disabling BatchLoader replace_methods
In production, we've seen the rendering times of the merge request widget increase as a result of loading commit data. BatchLoader attempts to call replace_methods on the lazy object, but this has a significant performance penalty for modules that have many methods. Disabling this mode (https://github.com/exAspArk/batch-loader/pull/45) appears to cut load times by about 50% for MergeRequestsController#show. Relates to https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/6941
-rw-r--r--app/models/commit.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index fa0bf36ba49..be37fa2e76f 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -94,7 +94,7 @@ class Commit
end
def lazy(project, oid)
- BatchLoader.for({ project: project, oid: oid }).batch do |items, loader|
+ BatchLoader.for({ project: project, oid: oid }).batch(replace_methods: false) do |items, loader|
items_by_project = items.group_by { |i| i[:project] }
items_by_project.each do |project, commit_ids|