diff --git a/internal/repository/master_index_test.go b/internal/repository/master_index_test.go index 2430c83dc..4456203ac 100644 --- a/internal/repository/master_index_test.go +++ b/internal/repository/master_index_test.go @@ -308,6 +308,20 @@ func BenchmarkMasterIndexLookupBlobSize(b *testing.B) { } } +func BenchmarkMasterIndexEach(b *testing.B) { + rng := rand.New(rand.NewSource(0)) + mIdx, _ := createRandomMasterIndex(b, rand.New(rng), 5, 200000) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + entries := 0 + for _ = range mIdx.Each(context.TODO()) { + entries++ + } + } +} + var ( snapshotTime = time.Unix(1470492820, 207401672) depth = 3