package benchmark import ( "testing" ) var ( str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) func BenchmarkHash(b *testing.B) { for i := 0; i < b.N; i++ { Hash([]byte(str)) } } func BenchmarkHash2(b *testing.B) { for i := 0; i < b.N; i++ { Hash2([]byte(str)) } } // Concurrent func BenchmarkHashParallel(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { Hash([]byte(str)) } }) } // Concurrent func BenchmarkHash2Parallel(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { Hash2([]byte(str)) } }) }