Merge pull request #116273 from sourcelliu/improveresource

Improve the performance when Resource Clone
This commit is contained in:
Kubernetes Prow Robot 2023-03-06 06:06:41 -08:00 committed by GitHub
commit 4185bf7238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -484,7 +484,7 @@ func (r *Resource) Clone() *Resource {
EphemeralStorage: r.EphemeralStorage,
}
if r.ScalarResources != nil {
res.ScalarResources = make(map[v1.ResourceName]int64)
res.ScalarResources = make(map[v1.ResourceName]int64, len(r.ScalarResources))
for k, v := range r.ScalarResources {
res.ScalarResources[k] = v
}