From 162629571d0d83e5d70b7a5988374f95575f4960 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Mon, 15 Aug 2016 21:37:19 +0200 Subject: [PATCH] Add BenchmarkFindUsedBlobs --- src/restic/find_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/restic/find_test.go b/src/restic/find_test.go index 17fbc83b0..f7e47bde4 100644 --- a/src/restic/find_test.go +++ b/src/restic/find_test.go @@ -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)) + } +}