Commit 61b47340 authored by Jeromy's avatar Jeromy

add a benchmark for our hash function

parent ff1e58a4
......@@ -53,3 +53,33 @@ func TestXOR(t *testing.T) {
}
}
}
func BenchmarkHash256K(b *testing.B) {
buf := make([]byte, 256*1024)
NewTimeSeededRand().Read(buf)
b.SetBytes(int64(256 * 1024))
b.ResetTimer()
for i := 0; i < b.N; i++ {
Hash(buf)
}
}
func BenchmarkHash512K(b *testing.B) {
buf := make([]byte, 512*1024)
NewTimeSeededRand().Read(buf)
b.SetBytes(int64(512 * 1024))
b.ResetTimer()
for i := 0; i < b.N; i++ {
Hash(buf)
}
}
func BenchmarkHash1M(b *testing.B) {
buf := make([]byte, 1024*1024)
NewTimeSeededRand().Read(buf)
b.SetBytes(int64(1024 * 1024))
b.ResetTimer()
for i := 0; i < b.N; i++ {
Hash(buf)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment