Fix benchmark for-loop shadowing

This commit is contained in:
Patrick Mylund Nielsen 2018-05-27 00:33:50 -04:00
parent a3647f8e31
commit 9f6ff22cff
2 changed files with 6 additions and 6 deletions

View File

@ -1563,12 +1563,12 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
wg.Add(n) wg.Add(n)
for _, v := range keys { for _, v := range keys {
go func() { go func(k string) {
for j := 0; j < each; j++ { for j := 0; j < each; j++ {
tc.Get(v) tc.Get(k)
} }
wg.Done() wg.Done()
}() }(v)
} }
b.StartTimer() b.StartTimer()
wg.Wait() wg.Wait()

View File

@ -73,12 +73,12 @@ func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
wg.Add(n) wg.Add(n)
for _, v := range keys { for _, v := range keys {
go func() { go func(k string) {
for j := 0; j < each; j++ { for j := 0; j < each; j++ {
tsc.Get(v) tsc.Get(k)
} }
wg.Done() wg.Done()
}() }(v)
} }
b.StartTimer() b.StartTimer()
wg.Wait() wg.Wait()