Commit 95a27394 authored by kargakis's avatar kargakis Committed by kargakis

cache: Avoid reallocs in Index

parent 769230e7
...@@ -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