Skip to content

Commit 1dee3c3

Browse files
committed
Add BenchmarkMap
1 parent 7c8cdd1 commit 1dee3c3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎hashstructure_test.go‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,37 @@ func TestHash_hashable(t *testing.T) {
675675
}
676676
}
677677

678+
func BenchmarkMap(b *testing.B) {
679+
m := map[string]any{
680+
"a": "b",
681+
"c": "d",
682+
"e": "f",
683+
"g": "h",
684+
"i": "j",
685+
"k": "l",
686+
"m": "n",
687+
"o": "p",
688+
"q": "r",
689+
"s": "t",
690+
"nested": map[string]string{
691+
"a": "b",
692+
"c": "d",
693+
"e": "f",
694+
"g": "h",
695+
"i": "j",
696+
"k": "l",
697+
"m": "n",
698+
"o": "p",
699+
"q": "r",
700+
"s": "t",
701+
},
702+
}
703+
704+
for i := 0; i < b.N; i++ {
705+
Hash(m, nil)
706+
}
707+
}
708+
678709
type testIncludable struct {
679710
Value string
680711
Ignore string

0 commit comments

Comments
 (0)