promtool: Add simple benchmark checkDuplicates benchmark

Add a simple benchmark with a large number of rules.

Signed-off-by: Holger Hans Peter Freyther <holger@moiji-mobile.com>
This commit is contained in:
Holger Hans Peter Freyther 2021-08-27 14:22:34 +08:00
parent 794937b3d6
commit 3a309c1ae5
2 changed files with 40021 additions and 0 deletions

View File

@ -151,3 +151,13 @@ func TestCheckDuplicates(t *testing.T) {
})
}
}
func BenchmarkCheckDuplicates(b *testing.B) {
rgs, err := rulefmt.ParseFile("./testdata/rules_large.yml")
require.Empty(b, err)
b.ResetTimer()
for i := 0; i < b.N; i++ {
checkDuplicates(rgs.Groups)
}
}

40011
cmd/promtool/testdata/rules_large.yml vendored Normal file

File diff suppressed because it is too large Load Diff