Skip to content

Commit

Permalink
ensure sorted history
Browse files Browse the repository at this point in the history
  • Loading branch information
krichprollsch committed Dec 7, 2023
1 parent 9e8788e commit 719d029
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bench/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"sort"
"time"

"github.com/lightpanda-io/perf-fmt/git"
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions wpt/wpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"sort"
"time"

"github.com/lightpanda-io/perf-fmt/git"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 719d029

Please sign in to comment.