From 49804083df763ec04a2b7f2d3cd9f10129cc7f7e Mon Sep 17 00:00:00 2001 From: wojtekt Date: Tue, 26 Mar 2019 14:14:42 +0100 Subject: [PATCH] Avoid allocations in ByIndex() function Kubernetes-commit: 7d46e27db185e5281b718ad964e9c2f8777c2fc8 --- tools/cache/thread_safe_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cache/thread_safe_store.go b/tools/cache/thread_safe_store.go index 5cbdd17e..b74faa01 100644 --- a/tools/cache/thread_safe_store.go +++ b/tools/cache/thread_safe_store.go @@ -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]) }