diff options
Diffstat (limited to 'internal/flamegraph/trie.go')
| -rw-r--r-- | internal/flamegraph/trie.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/flamegraph/trie.go b/internal/flamegraph/trie.go index 022b846..d7790c2 100644 --- a/internal/flamegraph/trie.go +++ b/internal/flamegraph/trie.go @@ -1,6 +1,9 @@ package flamegraph -import "sort" +import ( + "cmp" + "slices" +) type trieNode struct { name string @@ -35,8 +38,8 @@ func (t *trie) computeTotals() { t.maxDepth = depth } - sort.Slice(node.children, func(i, j int) bool { - return node.children[i].name < node.children[j].name + slices.SortFunc(node.children, func(a, b *trieNode) int { + return cmp.Compare(a.name, b.name) }) total := node.value |
