Beispiel #1
0
func TestBenchmarkSlow(t *testing.T) {
	r := buildRandom()
	results := "Bloom Benchmark\n"
	for _, bench := range benchmarks {
		for _, size := range sizes {
			for _, t := range types {
				bloom := t.constructor(uint64(size), collProb)
				benchmark := testing.Benchmark(func(b *testing.B) { bench.test(b, bloom, r[:size]) })
				nsPerOp := float64(benchmark.T.Nanoseconds()) / float64(size)
				results += fmt.Sprintf("%v\t%v\tSize:\t%8d Bloom Size:%10d Bloom Count:%10d Speed:%6.2f ns/op\n", t.name, bench.name, size, bloom.Size(), bloom.Count(), nsPerOp)
			}
		}
	}
	t.Log(results)
}