Skip to content

Commit

Permalink
Merge pull request #619 from bboreham/restore-sort
Browse files Browse the repository at this point in the history
LabelSet.String: restore faster sort call
  • Loading branch information
Arthur Silva Sens authored Apr 18, 2024
2 parents c1b9b72 + be294f1 commit e25b951
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions model/labelset_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package model

import (
"bytes"
"sort"
"slices"
"strconv"
)

Expand All @@ -28,7 +28,7 @@ func (l LabelSet) String() string {
for name := range l {
labelNames = append(labelNames, string(name))
}
sort.Strings(labelNames)
slices.Sort(labelNames)
var bytea [1024]byte // On stack to avoid memory allocation while building the output.
b := bytes.NewBuffer(bytea[:0])
b.WriteByte('{')
Expand Down

0 comments on commit e25b951

Please sign in to comment.