From e463587bad54661298d339d97f570bbc22566837 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 13 Jan 2017 21:27:37 +0100 Subject: [PATCH] Add BenchmarkDecodeIndex --- src/restic/repository/index_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/restic/repository/index_test.go b/src/restic/repository/index_test.go index 986f9efc7..7691bd953 100644 --- a/src/restic/repository/index_test.go +++ b/src/restic/repository/index_test.go @@ -326,6 +326,19 @@ func TestIndexUnserialize(t *testing.T) { } } +func BenchmarkDecodeIndex(b *testing.B) { + rd := bytes.NewReader(docExample) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, err := rd.Seek(0, 0) + OK(b, err) + _, err = repository.DecodeIndex(rd) + OK(b, err) + } +} + func TestIndexUnserializeOld(t *testing.T) { idx, err := repository.DecodeOldIndex(bytes.NewReader(docOldExample)) OK(t, err)