mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2026-01-08 00:01:40 +00:00
Automatic merge from submit-queue use bytes.Buffer instead of append for error string concat **What this PR does / why we need it**: 1. in my benchmark test, `bytes.Buffer` takes much less time ( about 1:1000 ) than string append( `+=` ). >BenchmarkAppendConcat-4 100000 151438 ns/op 578181 B/op 2 allocs/op BenchmarkBufferSprintf-4 3000000 487 ns/op 65 B/op 3 allocs/op BenchmarkBufferConcat-4 5000000 271 ns/op 47 B/op 1 allocs/op the benchmark codes is here https://play.golang.org/p/LS52zGuwZN 2. in our `RunInitMasterChecks`, `RunJoinNodeChecks` there are lots of preflight checks. they may result in a huge error message. so `bytes.Buffer` can bring considerable performance enhancement in the worst of conditions. beyond that, this PR 1. fix an exported struct comment, 1. and use `found = append( found, errs...)` instead of for loop for simplicity. Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>