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.
This commit is contained in:
Miek Gieben 2014-07-08 14:15:08 +00:00
parent 3710182f0f
commit d09d1781e8
1 changed files with 18 additions and 0 deletions

View File

@ -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)