Commit 46ee05ec authored by Robert Speicher's avatar Robert Speicher

Merge branch 'blobs-stitcher-optimisation' into 'master'

Remove string duplication in BlobStitcher

See merge request gitlab-org/gitlab!60406
parents 480e7f75 2b1d12c7
---
title: Remove string duplication in BlobStitcher
merge_request: 60406
author:
type: performance
......@@ -19,9 +19,9 @@ module Gitlab
yield new_blob(current_blob_data) if current_blob_data
current_blob_data = msg.to_h.slice(:oid, :path, :size, :revision, :mode)
current_blob_data[:data] = msg.data.dup
current_blob_data[:data_parts] = [msg.data]
else
current_blob_data[:data] << msg.data
current_blob_data[:data_parts] << msg.data
end
end
......@@ -31,6 +31,8 @@ module Gitlab
private
def new_blob(blob_data)
data = blob_data[:data_parts].join
Gitlab::Git::Blob.new(
id: blob_data[:oid],
mode: blob_data[:mode].to_s(8),
......@@ -38,8 +40,8 @@ module Gitlab
path: blob_data[:path],
size: blob_data[:size],
commit_id: blob_data[:revision],
data: blob_data[:data],
binary: Gitlab::Git::Blob.binary?(blob_data[:data])
data: data,
binary: Gitlab::Git::Blob.binary?(data)
)
end
end
......
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