gcs: add an extra benchmark for a filter with 100k items

This commit is contained in:
Olaoluwa Osuntokun 2017-06-08 18:25:38 -07:00
parent e87fef40f3
commit c26776fe48

View file

@ -55,6 +55,30 @@ func BenchmarkGCSFilterBuild50000(b *testing.B) {
generatedFilter = localFilter generatedFilter = localFilter
} }
// BenchmarkGCSFilterBuild benchmarks building a filter.
func BenchmarkGCSFilterBuild100000(b *testing.B) {
b.StopTimer()
var testKey [gcs.KeySize]byte
for i := 0; i < gcs.KeySize; i += 4 {
binary.BigEndian.PutUint32(testKey[i:], rand.Uint32())
}
randFilterElems, genErr := genRandFilterElements(100000)
if err != nil {
b.Fatalf("unable to generate random item: %v", genErr)
}
b.StartTimer()
var localFilter *gcs.Filter
for i := 0; i < b.N; i++ {
localFilter, err = gcs.BuildGCSFilter(P, key,
randFilterElems)
if err != nil {
b.Fatalf("unable to generate filter: %v", err)
}
}
generatedFilter = localFilter
}
var ( var (
match bool match bool
) )