Avoid allocations in ByIndex() function

Kubernetes-commit: 7d46e27db185e5281b718ad964e9c2f8777c2fc8
This commit is contained in:
wojtekt 2019-03-26 14:14:42 +01:00 committed by Kubernetes Publisher
parent ad771aa269
commit 49804083df

View File

@ -185,7 +185,7 @@ func (c *threadSafeMap) ByIndex(indexName, indexKey string) ([]interface{}, erro
set := index[indexKey]
list := make([]interface{}, 0, set.Len())
for _, key := range set.List() {
for key := range set {
list = append(list, c.items[key])
}