You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
378 B
27 lines
378 B
8 years ago
|
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)
|
||
|
}
|
||
|
}
|