From c9e01ed0a3aabd6c02088256bc97ad96e7928d62 Mon Sep 17 00:00:00 2001
From: Pierre Souchay
Date: Sun, 5 Apr 2020 11:12:41 +0200
Subject: [PATCH] Pre-allocations of DNS meta to avoid several allocations
---
agent/dns.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/agent/dns.go b/agent/dns.go
index 616f5c18ed..e95f49f410 100644
--- a/agent/dns.go
+++ b/agent/dns.go
@@ -1694,7 +1694,7 @@ func (d *DNSServer) nodeServiceRecords(dc string, node structs.CheckServiceNode,
}
func (d *DNSServer) generateMeta(dc string, qName string, node *structs.Node, ttl time.Duration) []dns.RR {
- var extra []dns.RR
+ extra := make([]dns.RR, 0, len(node.Meta))
for key, value := range node.Meta {
txt := value
if !strings.HasPrefix(strings.ToLower(key), "rfc1035-") {