From 4d257fe634410a2e715fc5507674b6458cfa18db Mon Sep 17 00:00:00 2001 From: guumaster Date: Tue, 14 Apr 2020 10:34:20 +0200 Subject: [PATCH] fix: remove unique check to speed up big profiles. --- pkg/host/parser.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/host/parser.go b/pkg/host/parser.go index af08e69..e611412 100644 --- a/pkg/host/parser.go +++ b/pkg/host/parser.go @@ -107,18 +107,6 @@ func parseProfileHeader(b []byte) (*Profile, error) { }, nil } -func uniqueStrings(xs []string) []string { - keys := make(map[string]bool) - var list []string - for _, entry := range xs { - if _, value := keys[entry]; !value { - keys[entry] = true - list = append(list, entry) - } - } - return list -} - func appendLine(p *Profile, line string) *Profile { if line == "" { return p @@ -135,7 +123,8 @@ func appendLine(p *Profile, line string) *Profile { p.Routes[ip] = route } else { p.Routes[ip].HostNames = append(p.Routes[ip].HostNames, route.HostNames...) - p.Routes[ip].HostNames = uniqueStrings(p.Routes[ip].HostNames) + // NOTE: Removed to speed up big profiles + // p.Routes[ip].HostNames = uniqueStrings(p.Routes[ip].HostNames) } return p }