Improve the performance when Resource Clone

Signed-off-by: mantuliu <240951888@qq.com>
This commit is contained in:
mantuliu 2023-03-05 00:35:51 +08:00
parent d48b8167f7
commit 83fdbd76a1

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
}