Merge pull request #75730 from wojtek-t/minor_perf_improvements

Avoid allocations in ByIndex() function

Kubernetes-commit: feb9bb151c6a52cf408d5f9fab0bc49b8ea886fc
This commit is contained in:
Kubernetes Publisher 2019-03-26 18:11:16 -07:00
commit 35ae057ca1

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])
}