Skip to content

Commit 330a3f5

Browse files
committed
Add benchmark for ParseDuration
Signed-off-by: Bryan Boreham <[email protected]>
1 parent 94c865c commit 330a3f5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

model/time_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,14 @@ func TestTimeJSON(t *testing.T) {
367367
}
368368

369369
}
370+
371+
func BenchmarkParseDuration(b *testing.B) {
372+
const data = "30s"
373+
374+
for i := 0; i < b.N; i++ {
375+
_, err := ParseDuration(data)
376+
if err != nil {
377+
b.Fatal(err)
378+
}
379+
}
380+
}

0 commit comments

Comments
 (0)