1
0
mirror of https://github.com/restic/restic.git synced 2024-06-28 08:00:52 +02:00

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)