Skip to content

Commit

Permalink
fix: remove unique check to speed up big profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
guumaster committed Apr 14, 2020
1 parent f8d5fe8 commit 4d257fe
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions pkg/host/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 4d257fe

Please sign in to comment.