From cd554b0af706b5f62b4e1bfde04091052b4aac61 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 18 Mar 2026 20:54:35 +0200 Subject: cleanup --- internal/statsengine/filerank.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'internal/statsengine/filerank.go') diff --git a/internal/statsengine/filerank.go b/internal/statsengine/filerank.go index dd83e8d..d24ab93 100644 --- a/internal/statsengine/filerank.go +++ b/internal/statsengine/filerank.go @@ -1,8 +1,9 @@ package statsengine import ( + "cmp" "container/heap" - "sort" + "slices" "ior/internal/event" "ior/internal/types" @@ -123,11 +124,11 @@ func buildFileSnapshots(inputs []fileSnapshotInput) []FileSnapshot { for _, in := range inputs { out = append(out, in.toSnapshot()) } - sort.Slice(out, func(i, j int) bool { - if out[i].Accesses != out[j].Accesses { - return out[i].Accesses > out[j].Accesses + slices.SortFunc(out, func(a, b FileSnapshot) int { + if a.Accesses != b.Accesses { + return cmp.Compare(b.Accesses, a.Accesses) } - return out[i].Path < out[j].Path + return cmp.Compare(a.Path, b.Path) }) return out } -- cgit v1.2.3