Merge pull request #12072 from bboreham/stringlabels-builder-size

labels-as-strings: size buffer for added labels
This commit is contained in:
Bryan Boreham 2023-03-07 09:27:56 +00:00 committed by GitHub
commit 99b3961907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -599,7 +599,8 @@ func (b *Builder) Labels(res Labels) Labels {
sort.Strings(b.del)
a, d := 0, 0
buf := make([]byte, 0, len(b.base.data)) // TODO: see if we can re-use the buffer from res.
bufSize := len(b.base.data) + labelsSize(b.add)
buf := make([]byte, 0, bufSize) // TODO: see if we can re-use the buffer from res.
for pos := 0; pos < len(b.base.data); {
oldPos := pos
var lName string