Add benchmark for LoadJSONPack

This commit is contained in:
Alexander Neumann 2015-10-26 20:47:48 +01:00
parent ae46674cd3
commit 7717ea5cca

View file

@ -175,6 +175,28 @@ func TestLoadJSONPack(t *testing.T) {
OK(t, err)
}
func BenchmarkLoadJSONPack(t *testing.B) {
repo := SetupRepo()
defer TeardownRepo(repo)
if BenchArchiveDirectory == "" {
t.Skip("benchdir not set, skipping")
}
// archive a few files
sn := SnapshotDir(t, repo, BenchArchiveDirectory, nil)
OK(t, repo.Flush())
tree := restic.NewTree()
t.ResetTimer()
for i := 0; i < t.N; i++ {
err := repo.LoadJSONPack(pack.Tree, *sn.Tree, &tree)
OK(t, err)
}
}
func TestLoadJSONUnpacked(t *testing.T) {
repo := SetupRepo()
defer TeardownRepo(repo)