From ccde866a2fefd3963499dfc9873bb9b17bd4855d Mon Sep 17 00:00:00 2001 From: mantuliu <240951888@qq.com> Date: Mon, 27 Feb 2023 23:53:19 +0800 Subject: [PATCH] Improve the performance of method CandidatesToVictimsMap Signed-off-by: mantuliu <240951888@qq.com> --- .../framework/plugins/defaultpreemption/default_preemption.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go index 711b54bf37d..b096f93ed14 100644 --- a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go +++ b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go @@ -127,7 +127,7 @@ func (pl *DefaultPreemption) GetOffsetAndNumCandidates(numNodes int32) (int32, i // This function is not applicable for out-of-tree preemption plugins that exercise // different preemption candidates on the same nominated node. func (pl *DefaultPreemption) CandidatesToVictimsMap(candidates []preemption.Candidate) map[string]*extenderv1.Victims { - m := make(map[string]*extenderv1.Victims) + m := make(map[string]*extenderv1.Victims, len(candidates)) for _, c := range candidates { m[c.Name()] = c.Victims() }