aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/hash/hash_func_test.go14
-rw-r--r--internal/hash/hash_log2_test.go9
2 files changed, 18 insertions, 5 deletions
diff --git a/internal/hash/hash_func_test.go b/internal/hash/hash_func_test.go
index 15919c3..a021ad8 100644
--- a/internal/hash/hash_func_test.go
+++ b/internal/hash/hash_func_test.go
@@ -28,8 +28,16 @@ func TestDefaultHash(t *testing.T) {
}
func BenchmarkDefaultHash(b *testing.B) {
- key := []byte("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG")
- for i := 0; i < b.N; i++ {
- defaultHash(key)
+ benchCases := []string{
+ "A",
+ "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",
+ }
+ for _, bc := range benchCases {
+ b.Run(bc, func(b *testing.B) {
+ key := []byte(bc)
+ for i := 0; i < b.N; i++ {
+ defaultHash(key)
+ }
+ })
}
}
diff --git a/internal/hash/hash_log2_test.go b/internal/hash/hash_log2_test.go
index f4c8bf3..869edba 100644
--- a/internal/hash/hash_log2_test.go
+++ b/internal/hash/hash_log2_test.go
@@ -31,7 +31,12 @@ func TestLog2(t *testing.T) {
}
func BenchmarkLog2(b *testing.B) {
- for i := 0; i < b.N; i++ {
- log2(1024)
+ benchCases := []uint32{1, 1024}
+ for _, bc := range benchCases {
+ b.Run(fmt.Sprintf("log(%v)", bc), func(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ log2(1024)
+ }
+ })
}
}