From 330a3f525e6d449501b16a6b119af32457cc4ffc Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 6 Mar 2023 12:50:38 +0000 Subject: [PATCH] Add benchmark for ParseDuration Signed-off-by: Bryan Boreham --- model/time_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/model/time_test.go b/model/time_test.go index 5ebebd5f..b0703fd1 100644 --- a/model/time_test.go +++ b/model/time_test.go @@ -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) + } + } +}