perf: pre-allocate slices

Signed-off-by: Ben Reedy <breed808@breed808.com>
This commit is contained in:
Ben Reedy
2024-05-13 08:31:11 +10:00
parent c713bed4e3
commit a49dee606b
4 changed files with 9 additions and 6 deletions

View File

@@ -163,11 +163,12 @@ func (c *Collectors) SetPerfCounterQuery() error {
var (
err error
perfCounterDependencies []string
perfCounterNames []string
perfIndicies []string
perfCounterNames []string
perfIndicies []string
)
perfCounterDependencies := make([]string, 0, len(c.collectors))
for _, collector := range c.collectors {
perfCounterNames, err = collector.GetPerfCounter()
if err != nil {