Commit c1c03bb4 authored by Dawn Chen's avatar Dawn Chen

Merge pull request #12139 from kargakis/avoid-reallocs-in-index

cache: Avoid reallocs in Index
parents e45493ec 95a27394
...@@ -150,7 +150,7 @@ func (c *threadSafeMap) Index(indexName string, obj interface{}) ([]interface{}, ...@@ -150,7 +150,7 @@ func (c *threadSafeMap) Index(indexName string, obj interface{}) ([]interface{},
} }
} }
list := []interface{}{} list := make([]interface{}, 0, returnKeySet.Len())
for absoluteKey := range returnKeySet { for absoluteKey := range returnKeySet {
list = append(list, c.items[absoluteKey]) list = append(list, c.items[absoluteKey])
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment