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:
parent
b27e4f14d1
commit
f99036b306
1 changed files with 14 additions and 0 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue