Codebase list golang-github-beorn7-perks / 5a2b7f29-664d-4282-baf1-54ab3aef92aa/main histogram / bench_test.go
5a2b7f29-664d-4282-baf1-54ab3aef92aa/main

Tree @5a2b7f29-664d-4282-baf1-54ab3aef92aa/main (Download .tar.gz)

bench_test.go @5a2b7f29-664d-4282-baf1-54ab3aef92aa/mainraw · 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)
	}
}