forked from TrueCloudLab/restic
Add benchmark for LoadJSONPack
This commit is contained in:
parent
ae46674cd3
commit
7717ea5cca
1 changed files with 22 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue