aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-11-13 14:54:15 +0100
committerBjørn Erik Pedersen <[email protected]>2024-11-13 14:57:18 +0100
commit8aba6dc661e71ffb50c3825c445d451ac5db0d7c (patch)
treecd7e5f6ea9ef0ef864df6cc3035bd0542ec1e51d
parenta7df536a52912f34d7d20c970c38590bf5e0c513 (diff)
downloadhugo-8aba6dc661e71ffb50c3825c445d451ac5db0d7c.tar.gz
hugo-8aba6dc661e71ffb50c3825c445d451ac5db0d7c.zip
parser/metadecoders: Add benchmark
-rw-r--r--parser/metadecoders/decoder_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/parser/metadecoders/decoder_test.go b/parser/metadecoders/decoder_test.go
index 734713c2e..49f7868cc 100644
--- a/parser/metadecoders/decoder_test.go
+++ b/parser/metadecoders/decoder_test.go
@@ -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)
+ }
+ }
+}