Skip to content

Commit

Permalink
Add BenchmarkMap
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jan 12, 2025
1 parent 7c8cdd1 commit 1dee3c3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions hashstructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,37 @@ func TestHash_hashable(t *testing.T) {
}
}

func BenchmarkMap(b *testing.B) {
m := map[string]any{
"a": "b",
"c": "d",
"e": "f",
"g": "h",
"i": "j",
"k": "l",
"m": "n",
"o": "p",
"q": "r",
"s": "t",
"nested": map[string]string{
"a": "b",
"c": "d",
"e": "f",
"g": "h",
"i": "j",
"k": "l",
"m": "n",
"o": "p",
"q": "r",
"s": "t",
},
}

for i := 0; i < b.N; i++ {
Hash(m, nil)
}
}

type testIncludable struct {
Value string
Ignore string
Expand Down

0 comments on commit 1dee3c3

Please sign in to comment.