2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 04:45:15 +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