@@ 1,6 1,8 @@
package seahash
import (
+ "hash/crc32"
+ "hash/crc64"
"hash/fnv"
"testing"
@@ 24,6 26,7 @@ func mkinput(n int) [][]byte {
}
return rv
}
+
func BenchmarkSeahash64(b *testing.B) {
input := mkinput(b.N)
output := make([]uint64, b.N)
@@ 35,6 38,31 @@ func BenchmarkSeahash64(b *testing.B) {
}
result = output
}
+
+func BenchmarkCrc32(b *testing.B) {
+ input := mkinput(b.N)
+ output := make([]uint32, b.N)
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ table := crc32.MakeTable(crc32.IEEE)
+
+ output[n] = crc32.Checksum(input[n], table)
+ }
+ result = output
+}
+
+func BenchmarkCrc64(b *testing.B) {
+ input := mkinput(b.N)
+ output := make([]uint64, b.N)
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ table := crc64.MakeTable(crc64.ISO)
+
+ output[n] = crc64.Checksum(input[n], table)
+ }
+ result = output
+}
+
func BenchmarkFnvHash32(b *testing.B) {
input := mkinput(b.N)
output := make([]uint32, b.N)