mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Perfomance: Preallocate slices (#61580)
This commit is contained in:
@@ -190,7 +190,7 @@ func (kv *SecretsKVStorePlugin) WithFallbackEnabled(fn func() error) error {
|
||||
}
|
||||
|
||||
func parseKeys(keys []*smp.Key) []Key {
|
||||
var newKeys []Key
|
||||
newKeys := make([]Key, 0, len(keys))
|
||||
|
||||
for _, k := range keys {
|
||||
newKey := Key{OrgId: k.OrgId, Namespace: k.Namespace, Type: k.Type}
|
||||
@@ -201,7 +201,7 @@ func parseKeys(keys []*smp.Key) []Key {
|
||||
}
|
||||
|
||||
func parseItems(items []*smp.Item) []Item {
|
||||
var newItems []Item
|
||||
newItems := make([]Item, 0, len(items))
|
||||
|
||||
for _, i := range items {
|
||||
newItem := Item{OrgId: &i.Key.OrgId, Namespace: &i.Key.Namespace, Type: &i.Key.Type, Value: i.Value}
|
||||
|
||||
Reference in New Issue
Block a user