1 package histogram 2 3 import ( 4 "math/rand" 5 "testing" 6 ) 7 8 func BenchmarkInsert10Bins(b *testing.B) { 9 b.StopTimer() 10 h := New(10) 11 b.StartTimer() 12 for i := 0; i < b.N; i++ { 13 f := rand.ExpFloat64() 14 h.Insert(f) 15 } 16 } 17 18 func BenchmarkInsert100Bins(b *testing.B) { 19 b.StopTimer() 20 h := New(100) 21 b.StartTimer() 22 for i := 0; i < b.N; i++ { 23 f := rand.ExpFloat64() 24 h.Insert(f) 25 } 26 } 27