mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-26 22:56:36 +00:00
perf: pre-allocate slices
Signed-off-by: Ben Reedy <breed808@breed808.com>
This commit is contained in:
@@ -373,7 +373,7 @@ func scrapeFile(path string, log log.Logger) ([]*dto.MetricFamily, error) {
|
||||
}
|
||||
|
||||
// Use temporary array to check for duplicates
|
||||
var families_array []*dto.MetricFamily
|
||||
families_array := make([]*dto.MetricFamily, 0, len(parsedFamilies))
|
||||
|
||||
for _, mf := range parsedFamilies {
|
||||
families_array = append(families_array, mf)
|
||||
|
||||
Reference in New Issue
Block a user