~blainsmith/seahash

b46b156adf82dd04d3891fcf492f19d6c98dfe34 — Blain Smith 19 days ago d11b510 main v1.2.1
add crc benchmarks
1 files changed, 28 insertions(+), 0 deletions(-)

M seahash_bench_test.go
M seahash_bench_test.go => seahash_bench_test.go +28 -0
@@ 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)