bench_test.go 378 字节
Newer Older
Y
Your Name 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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)
	}
}