Skip to content

Commit

Permalink
preallocate memory
Browse files Browse the repository at this point in the history
**What this PR does / why we need it:**

Preallocate memory instead of enforcing an incremental growth. This will result in less work for the garbage collector.
  • Loading branch information
florianl authored and tekton-robot committed Oct 14, 2022
1 parent a42d58a commit d416770
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/termination/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func ParseMessage(logger *zap.SugaredLogger, msg string) ([]v1beta1.PipelineReso
for _, rr := range r {
m[rr.Key] = rr
}
var r2 []v1beta1.PipelineResourceResult
r2 := make([]v1beta1.PipelineResourceResult, 0, len(m))
for _, v := range m {
r2 = append(r2, v)
}
Expand Down

0 comments on commit d416770

Please sign in to comment.