mirror of
https://github.com/Luzifer/promcertcheck.git
synced 2024-11-14 02:32:43 +00:00
26 lines
378 B
Go
26 lines
378 B
Go
package histogram
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkInsert10Bins(b *testing.B) {
|
|
b.StopTimer()
|
|
h := New(10)
|
|
b.StartTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
f := rand.ExpFloat64()
|
|
h.Insert(f)
|
|
}
|
|
}
|
|
|
|
func BenchmarkInsert100Bins(b *testing.B) {
|
|
b.StopTimer()
|
|
h := New(100)
|
|
b.StartTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
f := rand.ExpFloat64()
|
|
h.Insert(f)
|
|
}
|
|
}
|