From d09d1781e8453019bc71c2588775e3885c835538 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 8 Jul 2014 14:15:08 +0000 Subject: [PATCH] Add v6 benchmarking test. Mostly to exercise the v6 serving path (of which most lies in the standard library). But it also is a good test of v6 functionality. --- server_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server_test.go b/server_test.go index ae549945..e050c6c3 100644 --- a/server_test.go +++ b/server_test.go @@ -86,6 +86,24 @@ func BenchmarkServe(b *testing.B) { runtime.GOMAXPROCS(a) } +func BenchmarkServe6(b *testing.B) { + b.StopTimer() + HandleFunc("miek.nl.", HelloServer) + a := runtime.GOMAXPROCS(4) + go func() { + ListenAndServe("[::1]:8053", "udp", nil) + }() + c := new(Client) + m := new(Msg) + m.SetQuestion("miek.nl", TypeSOA) + + b.StartTimer() + for i := 0; i < b.N; i++ { + c.Exchange(m, "[::1]:8053") + } + runtime.GOMAXPROCS(a) +} + func HelloServerCompress(w ResponseWriter, req *Msg) { m := new(Msg) m.SetReply(req)