Skip to content

Commit

Permalink
add: bench for Inf+ use case
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Goncharov <[email protected]>
  • Loading branch information
imorph committed Oct 27, 2024
1 parent 3e49d04 commit 827feb2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions prometheus/histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1486,3 +1486,16 @@ func BenchmarkFindBucketLarge(b *testing.B) {
func BenchmarkFindBucketHuge(b *testing.B) {
benchmarkFindBucket(b, 500)
}

func BenchmarkFindBucketNone(b *testing.B) {
h := &histogram{upperBounds: make([]float64, 500)}
for i := range h.upperBounds {
h.upperBounds[i] = float64(i)
}
v := 1000.5

b.ResetTimer()
for i := 0; i < b.N; i++ {
resultFindBucket = h.findBucket(v)
}
}

0 comments on commit 827feb2

Please sign in to comment.