bump the buf size, allocate buf before loop

This commit is contained in:
Mateusz Poliwczak 2023-03-24 09:52:21 +01:00
parent 7c88c22ba2
commit 9dcc1bf1d8
1 changed files with 2 additions and 1 deletions

View File

@ -240,11 +240,12 @@ func (oi ObjectIdentifier) String() string {
var s strings.Builder
s.Grow(32)
buf := make([]byte, 0, 19)
for i, v := range oi {
if i > 0 {
s.WriteByte('.')
}
s.Write(strconv.AppendInt(make([]byte, 0, 16), int64(v), 10))
s.Write(strconv.AppendInt(buf[:0], int64(v), 10))
}
return s.String()