mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Avoid strings.Join which is expensive
This commit is contained in:
parent
5464c39333
commit
4d29c8608f
@ -1543,7 +1543,15 @@ func (proxier *Proxier) clearUDPConntrackForPort(port int) {
|
||||
|
||||
// Join all words with spaces, terminate with newline and write to buf.
|
||||
func writeLine(buf *bytes.Buffer, words ...string) {
|
||||
buf.WriteString(strings.Join(words, " ") + "\n")
|
||||
// We avoid strings.Join for performance reasons.
|
||||
for i := range words {
|
||||
buf.WriteString(words[i])
|
||||
if i < len(words)-1 {
|
||||
buf.WriteByte(' ')
|
||||
} else {
|
||||
buf.WriteByte('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isLocalIP(ip string) (bool, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user