From c04abc1bf8e4f31fd8da0068958fc550242940cb Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Thu, 1 Jan 2015 20:46:20 -0800 Subject: [PATCH] Fix benchmark - stop allocating on every iteration. --- keccak_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/keccak_test.go b/keccak_test.go index da4a046..a8f61fe 100644 --- a/keccak_test.go +++ b/keccak_test.go @@ -42,12 +42,8 @@ func TestKeccak512(t *testing.T) { func Benchmark256(b *testing.B) { var tmp [Size]byte h := New256() - var msg [BlockSize]byte - if len(msg) != h.BlockSize() { - b.Fatalf("message length does not match block size: want %d got %d", h.BlockSize(), len(msg)) - } b.SetBytes(BlockSize) for i := 0; i < b.N; i++ { - h.Sum(tmp[:]) + h.Sum(tmp[:0]) } }