mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
parser/metadecoders: Add benchmark
This commit is contained in:
parent
a7df536a52
commit
8aba6dc661
1 changed files with 23 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue