Skip to content

Commit

Permalink
Merge pull request #538 from grafana/fix-BenchmarkOptimizeEqualString…
Browse files Browse the repository at this point in the history
…Matchers

Fix BenchmarkOptimizeEqualStringMatchers
  • Loading branch information
colega authored Oct 2, 2023
2 parents c7c149e + cd91345 commit 8c43257
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion model/labels/regexp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,11 @@ func BenchmarkOptimizeEqualStringMatchers(b *testing.B) {
require.IsType(b, orStringMatcher{}, unoptimized)

optimized := optimizeEqualStringMatchers(unoptimized, 0)
require.IsType(b, &equalMultiStringMapMatcher{}, optimized)
if numAlternations < minEqualMultiStringMatcherMapThreshold {
require.IsType(b, &equalMultiStringSliceMatcher{}, optimized)
} else {
require.IsType(b, &equalMultiStringMapMatcher{}, optimized)
}

b.Run("without optimizeEqualStringMatchers()", func(b *testing.B) {
for n := 0; n < b.N; n++ {
Expand Down

0 comments on commit 8c43257

Please sign in to comment.