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:
parent
3710182f0f
commit
d09d1781e8
|
@ -86,6 +86,24 @@ func BenchmarkServe(b *testing.B) {
|
||||||
runtime.GOMAXPROCS(a)
|
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) {
|
func HelloServerCompress(w ResponseWriter, req *Msg) {
|
||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.SetReply(req)
|
m.SetReply(req)
|
||||||
|
|
Loading…
Reference in New Issue