Preallocates result struct, which was a profiling hot spot.

This commit is contained in:
James Phillips 2016-08-26 16:34:28 -07:00
parent 970bb771f9
commit 3a855d362f
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 1 additions and 1 deletions

View File

@ -1248,7 +1248,7 @@ func (s *StateStore) parseCheckServiceNodes(
return 0, nil, err
}
var results structs.CheckServiceNodes
results := make(structs.CheckServiceNodes, 0, len(services))
for _, sn := range services {
// Retrieve the node.
n, err := tx.First("nodes", "id", sn.Node)