Commit 9521d102 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch 'reduce-commit-collection-object-allocations' into 'master'

Reduce object allocations for large merge request

See merge request gitlab-org/gitlab!49563
parents 09ad779f 7e7a4b54
......@@ -86,9 +86,9 @@ class CommitCollection
# Batch load full Commits from the repository
# and map to a Hash of id => Commit
replacements = Hash[unenriched.map do |c|
[c.id, Commit.lazy(container, c.id)]
end.compact]
replacements = unenriched.each_with_object({}) do |c, result|
result[c.id] = Commit.lazy(container, c.id)
end.compact
# Replace the commits, keeping the same order
@commits = @commits.map do |original_commit|
......
---
title: Reduce object allocations for large merge request
merge_request: 49563
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment