diff --git a/bench/bench.go b/bench/bench.go index 5e31508..99c1c24 100644 --- a/bench/bench.go +++ b/bench/bench.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "sort" "time" "github.com/lightpanda-io/perf-fmt/git" @@ -90,6 +91,11 @@ func (a *Append) Append( allres = append(allres, outres) + // reorder slice + sort.Slice(allres, func(i, j int) bool { + return allres[i].Time.Before(allres[j].Time) + }) + // encode output enc := json.NewEncoder(out) if err := enc.Encode(allres); err != nil { diff --git a/wpt/wpt.go b/wpt/wpt.go index 4b0464d..bda086b 100644 --- a/wpt/wpt.go +++ b/wpt/wpt.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "sort" "time" "github.com/lightpanda-io/perf-fmt/git" @@ -85,6 +86,11 @@ func (a *Append) Append( allres = append(allres, outres) + // reorder slice + sort.Slice(allres, func(i, j int) bool { + return allres[i].Time.Before(allres[j].Time) + }) + // encode output enc := json.NewEncoder(out) if err := enc.Encode(allres); err != nil {