diff options
author | 2018-04-30 20:25:40 +0100 | |
---|---|---|
committer | 2018-04-30 20:25:40 +0100 | |
commit | a8fce24d468651df9bdc6dd5af5cb749ad03f687 (patch) | |
tree | 3a1354de4e154d57efe03bbce3c7a5ff57e251fb /plugin/cache/cache_test.go | |
parent | c0590e4ec4537f9c26e04ea68d310324b3225c59 (diff) | |
download | coredns-a8fce24d468651df9bdc6dd5af5cb749ad03f687.tar.gz coredns-a8fce24d468651df9bdc6dd5af5cb749ad03f687.tar.zst coredns-a8fce24d468651df9bdc6dd5af5cb749ad03f687.zip |
plugin/cache: fix benchmark (#1758)
Diffstat (limited to 'plugin/cache/cache_test.go')
-rw-r--r-- | plugin/cache/cache_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugin/cache/cache_test.go b/plugin/cache/cache_test.go index 812dd2b36..e67521986 100644 --- a/plugin/cache/cache_test.go +++ b/plugin/cache/cache_test.go @@ -231,15 +231,15 @@ func BenchmarkCacheResponse(b *testing.B) { reqs[i].SetQuestion(q+".example.org.", dns.TypeA) } - b.RunParallel(func(pb *testing.PB) { - i := 0 - for pb.Next() { - req := reqs[i] - c.ServeDNS(ctx, &test.ResponseWriter{}, req) - i++ - i = i % 5 - } - }) + b.StartTimer() + + j := 0 + for i := 0; i < b.N; i++ { + req := reqs[j] + c.ServeDNS(ctx, &test.ResponseWriter{}, req) + j++ + j = j % 5 + } } func BackendHandler() plugin.Handler { |