Add benchmark MasterIndexAlloc
This commit is contained in:
parent
66d089e239
commit
5e63294355
1 changed files with 9 additions and 0 deletions
|
@ -193,6 +193,15 @@ func createRandomMasterIndex(rng *rand.Rand, num, size int) (*repository.MasterI
|
||||||
return mIdx, lookupID
|
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) {
|
func BenchmarkMasterIndexLookupSingleIndex(b *testing.B) {
|
||||||
mIdx, lookupID := createRandomMasterIndex(rand.New(rand.NewSource(0)), 1, 200000)
|
mIdx, lookupID := createRandomMasterIndex(rand.New(rand.NewSource(0)), 1, 200000)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue