Commit 90fd1ceb authored by Yong Tang's avatar Yong Tang Committed by GitHub

Avoid copy of large value in `range` (#5243)

parent 90680b70
...@@ -66,7 +66,7 @@ func (c *Cache) Remove(key uint64) { ...@@ -66,7 +66,7 @@ func (c *Cache) Remove(key uint64) {
// Len returns the number of elements in the cache. // Len returns the number of elements in the cache.
func (c *Cache) Len() int { func (c *Cache) Len() int {
l := 0 l := 0
for _, s := range c.shards { for _, s := range &c.shards {
l += s.Len() l += s.Len()
} }
return l return l
...@@ -74,7 +74,7 @@ func (c *Cache) Len() int { ...@@ -74,7 +74,7 @@ func (c *Cache) Len() int {
// Walk walks each shard in the cache. // Walk walks each shard in the cache.
func (c *Cache) Walk(f func(map[uint64]interface{}, uint64) bool) { func (c *Cache) Walk(f func(map[uint64]interface{}, uint64) bool) {
for _, s := range c.shards { for _, s := range &c.shards {
s.Walk(f) s.Walk(f)
} }
} }
......
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