diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-18 20:54:35 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-18 20:54:35 +0200 |
| commit | cd554b0af706b5f62b4e1bfde04091052b4aac61 (patch) | |
| tree | e6d02f1c2a1da27da17386e8832c2d4a3e699cdf /internal/tui/flamegraph/model.go | |
| parent | b421b2232351049277ee4ad5b31367bb2b6779bb (diff) | |
cleanup
Diffstat (limited to 'internal/tui/flamegraph/model.go')
| -rw-r--r-- | internal/tui/flamegraph/model.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/tui/flamegraph/model.go b/internal/tui/flamegraph/model.go index a7b26f8..0552a4f 100644 --- a/internal/tui/flamegraph/model.go +++ b/internal/tui/flamegraph/model.go @@ -1,11 +1,11 @@ package flamegraph import ( + "cmp" "encoding/json" "fmt" "image/color" "slices" - "sort" "strings" "time" @@ -727,8 +727,8 @@ func framesAtDepthFiltered(frames []tuiFrame, depth int, include map[int]bool) [ indices = append(indices, idx) } } - sort.Slice(indices, func(i, j int) bool { - return frames[indices[i]].Col < frames[indices[j]].Col + slices.SortFunc(indices, func(a, b int) int { + return cmp.Compare(frames[a].Col, frames[b].Col) }) return indices } @@ -878,19 +878,19 @@ func (m Model) visibleTraversalOrder() []int { } indices = append(indices, idx) } - sort.Slice(indices, func(i, j int) bool { - left := m.frames[indices[i]] - right := m.frames[indices[j]] + slices.SortFunc(indices, func(a, b int) int { + left := m.frames[a] + right := m.frames[b] if left.Depth != right.Depth { - return left.Depth < right.Depth + return cmp.Compare(left.Depth, right.Depth) } if left.Col != right.Col { - return left.Col < right.Col + return cmp.Compare(left.Col, right.Col) } if left.Row != right.Row { - return left.Row < right.Row + return cmp.Compare(left.Row, right.Row) } - return indices[i] < indices[j] + return cmp.Compare(a, b) }) return indices } |
