mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Performance: Add preallocation for some slices (#59593)
This commit is contained in:
@@ -222,7 +222,6 @@ func (c *cache) getAll(orgID int64) []*State {
|
||||
}
|
||||
|
||||
func (c *cache) getStatesForRuleUID(orgID int64, alertRuleUID string) []*State {
|
||||
var result []*State
|
||||
c.mtxStates.RLock()
|
||||
defer c.mtxStates.RUnlock()
|
||||
orgRules, ok := c.states[orgID]
|
||||
@@ -233,6 +232,7 @@ func (c *cache) getStatesForRuleUID(orgID int64, alertRuleUID string) []*State {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
result := make([]*State, 0, len(rs.states))
|
||||
for _, state := range rs.states {
|
||||
result = append(result, state)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user