From 626934a05914515728876d91d81a5d08e8f794e1 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 20 Jun 2022 15:27:01 +0800 Subject: [PATCH] move out label copy and params copy to the outside of the loop --- pkg/optimizer/grid.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/optimizer/grid.go b/pkg/optimizer/grid.go index 64d2e2b32..a9b11efdb 100644 --- a/pkg/optimizer/grid.go +++ b/pkg/optimizer/grid.go @@ -176,10 +176,10 @@ func (o *GridOptimizer) Run(executor Executor, configJson []byte) (map[string][] return err } + var labels = copyLabels(o.ParamLabels) + var currentParams = copyParams(o.CurrentParams) for metricName, metricFunc := range valueFunctions { var metricValue = metricFunc(summaryReport) - var currentParams = copyParams(o.CurrentParams) - var labels = copyLabels(o.ParamLabels) metrics[metricName] = append(metrics[metricName], Metric{ Params: currentParams,