Skip to content

Commit

Permalink
refactor: Preallocate pieceDigests slice in genMetadata for improved (#…
Browse files Browse the repository at this point in the history
…3325)

Signed-off-by: yantingqiu <[email protected]>
  • Loading branch information
yantingqiu authored Jul 3, 2024
1 parent 430ef22 commit fae3613
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/daemon/storage/local_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (t *localTaskStore) genMetadata(n int64, req *WritePieceRequest) {
t.TotalPieces = total
t.ContentLength = contentLength

var pieceDigests []string
pieceDigests := make([]string, 0, t.TotalPieces)
for i := int32(0); i < t.TotalPieces; i++ {
pieceDigests = append(pieceDigests, t.Pieces[i].Md5)
}
Expand Down

0 comments on commit fae3613

Please sign in to comment.