parser/metadecoders: Add benchmark

This commit is contained in:
Bjørn Erik Pedersen 2024-11-13 14:54:15 +01:00
parent a7df536a52
commit 8aba6dc661
No known key found for this signature in database

View file

@ -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)
}
}
}