Codebase list golang-github-beorn7-perks / upstream/1.0.0 histogram / bench_test.go
upstream/1.0.0

Tree @upstream/1.0.0 (Download .tar.gz)

bench_test.go @upstream/1.0.0raw · history · blame

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)
	}
}