Skip to content

Commit

Permalink
parser/metadecoders: Add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Nov 13, 2024
1 parent a7df536 commit 8aba6dc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions parser/metadecoders/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,26 @@ func BenchmarkStringifyMapKeysIntegers(b *testing.B) {
stringifyMapKeys(maps[i])
}
}

func BenchmarkDecodeYAMLToMap(b *testing.B) {
d := Default

data := []byte(`
a:
v1: 32
v2: 43
v3: "foo"
b:
- a
- b
c: "d"
`)

for i := 0; i < b.N; i++ {
_, err := d.UnmarshalToMap(data, YAML)
if err != nil {
b.Fatal(err)
}
}
}

0 comments on commit 8aba6dc

Please sign in to comment.