Performance: add preallocation for some slice/map (#57860)
This change preallocates slices and maps where the size of the data is known before the object is created. Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
This commit is contained in:
co-authored by
Joe Blubaugh
parent
460be70261
commit
4d8287b319
@@ -212,7 +212,7 @@ func (m *migration) createNotifier(c *notificationChannel) (*PostableGrafanaRece
|
||||
|
||||
// Create one receiver for every unique notification channel.
|
||||
func (m *migration) createReceivers(allChannels []*notificationChannel) (map[uidOrID]*PostableApiReceiver, []*PostableApiReceiver, error) {
|
||||
var receivers []*PostableApiReceiver
|
||||
receivers := make([]*PostableApiReceiver, 0, len(allChannels))
|
||||
receiversMap := make(map[uidOrID]*PostableApiReceiver)
|
||||
|
||||
set := make(map[string]struct{}) // Used to deduplicate sanitized names.
|
||||
|
||||
Reference in New Issue
Block a user