Skip to content

Commit

Permalink
[chore] [exporter/signalfx] preallocate slice for faster performance (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Aug 7, 2023
1 parent 6ccfaf1 commit 7d8e452
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func NewFilterSet(excludes []MetricFilter, includes []MetricFilter) (*FilterSet,
}

func getDataPointFilters(metricFilters []MetricFilter) ([]*dataPointFilter, error) {
var out []*dataPointFilter
for _, f := range metricFilters {
out := make([]*dataPointFilter, len(metricFilters))
for i, f := range metricFilters {
dimSet, err := f.normalize()
if err != nil {
return nil, err
Expand All @@ -60,7 +60,7 @@ func getDataPointFilters(metricFilters []MetricFilter) ([]*dataPointFilter, erro
return nil, err
}

out = append(out, dpf)
out[i] = dpf
}
return out, nil
}

0 comments on commit 7d8e452

Please sign in to comment.