Skip to content

Commit

Permalink
Add benchmark for ParseDuration
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
  • Loading branch information
bboreham committed Mar 6, 2023
1 parent 94c865c commit 330a3f5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions model/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,14 @@ func TestTimeJSON(t *testing.T) {
}

}

func BenchmarkParseDuration(b *testing.B) {
const data = "30s"

for i := 0; i < b.N; i++ {
_, err := ParseDuration(data)
if err != nil {
b.Fatal(err)
}
}
}

0 comments on commit 330a3f5

Please sign in to comment.