Skip to content

Commit

Permalink
LabelSet.String: restore faster sort call
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
  • Loading branch information
bboreham committed Apr 13, 2024
1 parent 0234594 commit be294f1
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 be294f1

Please sign in to comment.