From: Matt Joiner Date: Sat, 11 Sep 2021 11:17:31 +0000 (+1000) Subject: Pre-allocate request strategy pieces X-Git-Tag: v1.32.0~52 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=377eabd7b49a8bb2278886f2683a435bd0eaae86;p=btrtrc.git Pre-allocate request strategy pieces --- diff --git a/requesting.go b/requesting.go index 16da8393..6a10e0a9 100644 --- a/requesting.go +++ b/requesting.go @@ -46,6 +46,7 @@ func (cl *Client) doRequests() { if t.storage != nil { rst.Capacity = t.storage.Capacity } + rst.Pieces = make([]request_strategy.Piece, 0, len(t.pieces)) for i := range t.pieces { p := &t.pieces[i] rst.Pieces = append(rst.Pieces, request_strategy.Piece{