From 5e63294355884f13d6355d5f754e4378a43d4dc7 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Wed, 5 Aug 2020 06:28:24 +0200 Subject: [PATCH] Add benchmark MasterIndexAlloc --- internal/repository/master_index_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/repository/master_index_test.go b/internal/repository/master_index_test.go index 61e2377ce..79ad5483c 100644 --- a/internal/repository/master_index_test.go +++ b/internal/repository/master_index_test.go @@ -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)