mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
util/dnsname: add a benchmark for ToFQDN.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
caaefa00a0
commit
d7f6ef3a79
@ -185,3 +185,24 @@ func TestTrimSuffix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sinkFQDN FQDN
|
||||||
|
|
||||||
|
func BenchmarkToFQDN(b *testing.B) {
|
||||||
|
tests := []string{
|
||||||
|
"www.tailscale.com.",
|
||||||
|
"www.tailscale.com",
|
||||||
|
".www.tailscale.com",
|
||||||
|
"_ssh._tcp.www.tailscale.com.",
|
||||||
|
"_ssh._tcp.www.tailscale.com",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
b.Run(test, func(b *testing.B) {
|
||||||
|
b.ReportAllocs()
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
sinkFQDN, _ = ToFQDN(test)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user