Fix benchmark - stop allocating on every iteration.

master
magical 2015-01-01 20:46:20 -08:00
parent 33dc508782
commit c04abc1bf8
1 changed files with 1 additions and 5 deletions

View File

@ -42,12 +42,8 @@ func TestKeccak512(t *testing.T) {
func Benchmark256(b *testing.B) { func Benchmark256(b *testing.B) {
var tmp [Size]byte var tmp [Size]byte
h := New256() 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) b.SetBytes(BlockSize)
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
h.Sum(tmp[:]) h.Sum(tmp[:0])
} }
} }