mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-01 15:17:19 +00:00
Optimized map allocation in Replace methods
Initial allocation of several maps as the sizes are known Signed-off-by: Adrián Orive <adrian.orive.oneca@gmail.com> Kubernetes-commit: 2299f45f52464beff889fce7be1f66642a92b791
This commit is contained in:
committed by
Kubernetes Publisher
parent
045bdd8bd8
commit
d016aa7909
2
tools/cache/expiration_cache.go
vendored
2
tools/cache/expiration_cache.go
vendored
@@ -179,7 +179,7 @@ func (c *ExpirationCache) Delete(obj interface{}) error {
|
||||
func (c *ExpirationCache) Replace(list []interface{}, resourceVersion string) error {
|
||||
c.expirationLock.Lock()
|
||||
defer c.expirationLock.Unlock()
|
||||
items := map[string]interface{}{}
|
||||
items := make(map[string]interface{}, len(list))
|
||||
ts := c.clock.Now()
|
||||
for _, item := range list {
|
||||
key, err := c.keyFunc(item)
|
||||
|
Reference in New Issue
Block a user