1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

repository: add benchmark for MasterIndex.Each

This commit is contained in:
Michael Eischer 2022-09-11 00:24:39 +02:00
parent b48766d7b8
commit 825b95e313

View file

@ -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