示例#1
0
func BenchmarkMetro16(b *testing.B) { benchmarkHashn(b, 16, hmetro) }
func BenchmarkMetro40(b *testing.B) { benchmarkHashn(b, 40, hmetro) }
func BenchmarkMetro64(b *testing.B) { benchmarkHashn(b, 64, hmetro) }
func BenchmarkMetro1K(b *testing.B) { benchmarkHashn(b, 1024, hmetro) }
func BenchmarkMetro8K(b *testing.B) { benchmarkHashn(b, 8192, hmetro) }

var hxxhash = func(k []byte) uint64 { return xxhash.Checksum64(k) }

func BenchmarkXXHash8(b *testing.B)  { benchmarkHashn(b, 8, hxxhash) }
func BenchmarkXXHash16(b *testing.B) { benchmarkHashn(b, 16, hxxhash) }
func BenchmarkXXHash40(b *testing.B) { benchmarkHashn(b, 40, hxxhash) }
func BenchmarkXXHash64(b *testing.B) { benchmarkHashn(b, 64, hxxhash) }
func BenchmarkXXHash1K(b *testing.B) { benchmarkHashn(b, 1024, hxxhash) }
func BenchmarkXXHash8K(b *testing.B) { benchmarkHashn(b, 8192, hxxhash) }

var fsthash = func(k []byte) uint64 { return fasthash.Hash64(0, k) }

func BenchmarkFasthash8(b *testing.B)  { benchmarkHashn(b, 8, fsthash) }
func BenchmarkFasthash16(b *testing.B) { benchmarkHashn(b, 16, fsthash) }
func BenchmarkFasthash40(b *testing.B) { benchmarkHashn(b, 40, fsthash) }
func BenchmarkFasthash64(b *testing.B) { benchmarkHashn(b, 64, fsthash) }
func BenchmarkFasthash1K(b *testing.B) { benchmarkHashn(b, 1024, fsthash) }
func BenchmarkFasthash8K(b *testing.B) { benchmarkHashn(b, 8192, fsthash) }

var high = func(k []byte) uint64 { return highway.Hash(highway.Lanes{}, k) }

func BenchmarkHighway8(b *testing.B)  { benchmarkHashn(b, 8, high) }
func BenchmarkHighway16(b *testing.B) { benchmarkHashn(b, 16, high) }
func BenchmarkHighway40(b *testing.B) { benchmarkHashn(b, 40, high) }
func BenchmarkHighway64(b *testing.B) { benchmarkHashn(b, 64, high) }
func BenchmarkHighway1K(b *testing.B) { benchmarkHashn(b, 1024, high) }
func BenchmarkFnv64(b *testing.B)  { benchmarkHash64(b, hfnv) }
func BenchmarkFnv128(b *testing.B) { benchmarkHash128(b, hfnv) }
func BenchmarkFnv1K(b *testing.B)  { benchmarkHash1K(b, hfnv) }
func BenchmarkFnv8K(b *testing.B)  { benchmarkHash8K(b, hfnv) }

var hfnv64a = func(p []byte) uint64 { h := fnv.New64a(); h.Write(p); return h.Sum64() }

func BenchmarkFnv64a8(b *testing.B)   { benchmarkHash8(b, hfnv64a) }
func BenchmarkFnv64a16(b *testing.B)  { benchmarkHash16(b, hfnv64a) }
func BenchmarkFnv64a40(b *testing.B)  { benchmarkHash40(b, hfnv64a) }
func BenchmarkFnv64a64(b *testing.B)  { benchmarkHash64(b, hfnv64a) }
func BenchmarkFnv64a128(b *testing.B) { benchmarkHash128(b, hfnv64a) }
func BenchmarkFnv64a1K(b *testing.B)  { benchmarkHash1K(b, hfnv64a) }
func BenchmarkFnv64a8K(b *testing.B)  { benchmarkHash8K(b, hfnv64a) }

var hfasthash = func(p []byte) uint64 { return fasthash.Hash64(0, p) }

func BenchmarkFasthash8(b *testing.B)   { benchmarkHash8(b, hfasthash) }
func BenchmarkFasthash16(b *testing.B)  { benchmarkHash16(b, hfasthash) }
func BenchmarkFasthash40(b *testing.B)  { benchmarkHash40(b, hfasthash) }
func BenchmarkFasthash64(b *testing.B)  { benchmarkHash64(b, hfasthash) }
func BenchmarkFasthash128(b *testing.B) { benchmarkHash128(b, hfasthash) }
func BenchmarkFasthash1K(b *testing.B)  { benchmarkHash1K(b, hfasthash) }
func BenchmarkFasthash8K(b *testing.B)  { benchmarkHash8K(b, hfasthash) }

var hspooky = func(p []byte) uint64 { return spooky.Hash64(p) }

func BenchmarkSpooky8(b *testing.B)   { benchmarkHash8(b, hspooky) }
func BenchmarkSpooky16(b *testing.B)  { benchmarkHash16(b, hspooky) }
func BenchmarkSpooky40(b *testing.B)  { benchmarkHash40(b, hspooky) }
func BenchmarkSpooky64(b *testing.B)  { benchmarkHash64(b, hspooky) }