plugin/cache: fix benchmark (#1758)
This commit is contained in:
parent
c0590e4ec4
commit
a8fce24d46
1 changed files with 9 additions and 9 deletions
18
plugin/cache/cache_test.go
vendored
18
plugin/cache/cache_test.go
vendored
|
@ -231,15 +231,15 @@ func BenchmarkCacheResponse(b *testing.B) {
|
||||||
reqs[i].SetQuestion(q+".example.org.", dns.TypeA)
|
reqs[i].SetQuestion(q+".example.org.", dns.TypeA)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.RunParallel(func(pb *testing.PB) {
|
b.StartTimer()
|
||||||
i := 0
|
|
||||||
for pb.Next() {
|
j := 0
|
||||||
req := reqs[i]
|
for i := 0; i < b.N; i++ {
|
||||||
c.ServeDNS(ctx, &test.ResponseWriter{}, req)
|
req := reqs[j]
|
||||||
i++
|
c.ServeDNS(ctx, &test.ResponseWriter{}, req)
|
||||||
i = i % 5
|
j++
|
||||||
}
|
j = j % 5
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BackendHandler() plugin.Handler {
|
func BackendHandler() plugin.Handler {
|
||||||
|
|
Loading…
Add table
Reference in a new issue