Use correct buffer size for benchmark

This commit is contained in:
Alexander Neumann 2015-02-17 17:51:46 +01:00
parent 4fd8222da6
commit be03a31bdd

View file

@ -156,12 +156,11 @@ func BenchmarkEncrypt(b *testing.B) {
b.ResetTimer() b.ResetTimer()
b.SetBytes(int64(size)) b.SetBytes(int64(size))
buf := restic.GetChunkBuf("BenchmarkEncrypt") buf := make([]byte, len(data)+restic.CiphertextExtension)
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
_, err := k.Encrypt(buf, data) _, err := k.Encrypt(buf, data)
ok(b, err) ok(b, err)
} }
restic.FreeChunkBuf("BenchmarkEncrypt", buf)
} }
func BenchmarkDecryptReader(b *testing.B) { func BenchmarkDecryptReader(b *testing.B) {