Debian Codegraph @

bench_test.go

raw
1 package dns
2
3 import (
4 "testing"
5
6 "codeberg.org/miekg/dns/internal/pack"
7 )
8
9 // BenchmarkCreateMsg benchmarks the creation of a small Msg with a question section only.
10 func BenchmarkMakeMsgQuestionMX(b *testing.B) {
11 for b.Loop() {
12 msg := new(Msg)
13 msg.ID = ID()
14 msg.RecursionDesired = true
15 msg.Question = []RR{&MX{Hdr: Header{Name: "miek.nl."}}}
16 msg.Pack()
17 }
18 }
19
20 func BenchmarkPackName(b *testing.B) {
21 name := "my.testserver.l.miek.nl."
22 buf := make([]byte, 30)
23 for b.Loop() {
24 pack.Name(name, buf, 0, nil, false)
25 }
26 }