Perfomance: Preallocate slices (#61580)

This commit is contained in:
Denis Limarev
2023-01-17 11:50:17 +00:00
committed by GitHub
parent d2a5b9b289
commit e6dee8a723
13 changed files with 20 additions and 17 deletions
@@ -54,7 +54,8 @@ func (m *actionNameMigrator) migrateActionNames() error {
"alert.rules:update": accesscontrol.ActionAlertingRuleUpdate,
}
var oldActionNames, newActionNames []interface{}
oldActionNames := make([]interface{}, 0, len(actionNameMapping))
newActionNames := make([]interface{}, 0, len(actionNameMapping))
for oldName, newName := range actionNameMapping {
oldActionNames = append(oldActionNames, oldName)
newActionNames = append(newActionNames, newName)