mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
msg.Service: optimize a bit (#2374)
Make the NewSRV and friends slightly smarter. Optimize the calling of targetStrip which is almost certainly not used. Added benchmark show a modest improvement: benchmark old ns/op new ns/op delta BenchmarkNewSRV-4 300 283 -5.67% Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -123,3 +123,11 @@ func TestGroup(t *testing.T) {
|
||||
t.Fatalf("Failure to group seventh set: %v", sx)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkNewSRV(b *testing.B) {
|
||||
s := &Service{Host: "www,example.org", Port: 8080}
|
||||
for n := 0; n < b.N; n++ {
|
||||
srv := s.NewSRV("www.example.org.", 16)
|
||||
srv = srv
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user