diff options
author | 2016-04-04 08:19:06 +0100 | |
---|---|---|
committer | 2016-04-04 08:19:06 +0100 | |
commit | 84dfdab58499214df3be14395deb8fc3ff61f9c0 (patch) | |
tree | b0bfd25e74e28e6a166268f67a6521d0dfca1110 /middleware/file/ent_test.go | |
parent | b3b6fe48f665500afc2bf9a51986fc1cc9f9fccc (diff) | |
download | coredns-84dfdab58499214df3be14395deb8fc3ff61f9c0.tar.gz coredns-84dfdab58499214df3be14395deb8fc3ff61f9c0.tar.zst coredns-84dfdab58499214df3be14395deb8fc3ff61f9c0.zip |
Cache elements of State
Cache the size and the do bit whenever someone asked for it. We can
probably add more:
PASS
BenchmarkStateDo-4 100000000 11.9 ns/op
BenchmarkStateSize-4 5000000 265 ns/op
ok github.com/miekg/coredns/middleware 2.828s
PASS
BenchmarkStateDo-4 1000000000 2.86 ns/op
BenchmarkStateSize-4 500000000 3.10 ns/op
ok github.com/miekg/coredns/middleware 5.032s
This PR also includes some testing cleanups as well.
Diffstat (limited to 'middleware/file/ent_test.go')
-rw-r--r-- | middleware/file/ent_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/middleware/file/ent_test.go b/middleware/file/ent_test.go index 38f68e8e1..8059390fe 100644 --- a/middleware/file/ent_test.go +++ b/middleware/file/ent_test.go @@ -42,7 +42,7 @@ func TestLookupENT(t *testing.T) { for _, tc := range entTestCases { m := tc.Msg() - rec := middleware.NewResponseRecorder(&middleware.TestResponseWriter{}) + rec := middleware.NewResponseRecorder(&coretest.ResponseWriter{}) _, err := fm.ServeDNS(ctx, rec, m) if err != nil { t.Errorf("expected no error, got %v\n", err) |