Add BenchmarkFindUsedBlobs

This commit is contained in:
Alexander Neumann 2016-08-15 21:37:19 +02:00
parent 2c04ad3c29
commit 162629571d
1 changed files with 20 additions and 0 deletions

View File

@ -116,3 +116,23 @@ func TestFindUsedBlobs(t *testing.T) {
} }
} }
} }
func BenchmarkFindUsedBlobs(b *testing.B) {
repo, cleanup := repository.TestRepository(b)
defer cleanup()
sn := TestCreateSnapshot(b, repo, findTestTime, findTestDepth, 0)
b.ResetTimer()
for i := 0; i < b.N; i++ {
seen := pack.NewBlobSet()
blobs := pack.NewBlobSet()
err := FindUsedBlobs(repo, *sn.Tree, blobs, seen)
if err != nil {
b.Error(err)
}
b.Logf("found %v blobs", len(blobs))
}
}