Add benchmark MasterIndexAlloc

This commit is contained in:
Alexander Weiss 2020-08-05 06:28:24 +02:00
parent 66d089e239
commit 5e63294355
1 changed files with 9 additions and 0 deletions

View File

@ -193,6 +193,15 @@ func createRandomMasterIndex(rng *rand.Rand, num, size int) (*repository.MasterI
return mIdx, lookupID
}
func BenchmarkMasterIndexAlloc(b *testing.B) {
rng := rand.New(rand.NewSource(0))
b.ReportAllocs()
for i := 0; i < b.N; i++ {
createRandomMasterIndex(rng, 10000, 5)
}
}
func BenchmarkMasterIndexLookupSingleIndex(b *testing.B) {
mIdx, lookupID := createRandomMasterIndex(rand.New(rand.NewSource(0)), 1, 200000)