1
0
Fork 0
mirror of https://github.com/vbatts/merkle.git synced 2024-11-27 08:45:39 +00:00

benchmark: and compare sha256 as well

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2015-10-19 15:03:05 -04:00
parent b27e4f14d1
commit f99036b306

View file

@ -1,6 +1,7 @@
package merkle package merkle
import ( import (
"crypto/sha256"
"crypto/sha512" "crypto/sha512"
"fmt" "fmt"
"hash" "hash"
@ -140,6 +141,7 @@ func TestMerkleHashWriter(t *testing.T) {
} }
var benchDefault = NewHash(DefaultHashMaker, 8192) var benchDefault = NewHash(DefaultHashMaker, 8192)
var benchSha256 = NewHash(func() hash.Hash { return sha256.New() }, 8192)
var benchSha512 = NewHash(func() hash.Hash { return sha512.New() }, 8192) var benchSha512 = NewHash(func() hash.Hash { return sha512.New() }, 8192)
var buf = make([]byte, 8192) var buf = make([]byte, 8192)
@ -165,6 +167,18 @@ func BenchmarkHash8K(b *testing.B) {
benchmarkSize(benchDefault, b, 8192) benchmarkSize(benchDefault, b, 8192)
} }
func BenchmarkSha256Hash8Bytes(b *testing.B) {
benchmarkSize(benchSha256, b, 8)
}
func BenchmarkSha256Hash1K(b *testing.B) {
benchmarkSize(benchSha256, b, 1024)
}
func BenchmarkSha256Hash8K(b *testing.B) {
benchmarkSize(benchSha256, b, 8192)
}
func BenchmarkSha512Hash8Bytes(b *testing.B) { func BenchmarkSha512Hash8Bytes(b *testing.B) {
benchmarkSize(benchSha512, b, 8) benchmarkSize(benchSha512, b, 8)
} }