From: Bjørn Erik Pedersen Date: Mon, 13 Jan 2025 08:32:41 +0000 (+0200) Subject: tpl/collections: Add Merge benchmark X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=39f582f9f43ffefce24a3e162142ed58d7841c6c;p=brevno-suite%2Fhugo tpl/collections: Add Merge benchmark --- diff --git a/tpl/collections/merge_test.go b/tpl/collections/merge_test.go index 7809152d4..a8ef0afea 100644 --- a/tpl/collections/merge_test.go +++ b/tpl/collections/merge_test.go @@ -159,6 +159,18 @@ func TestMerge(t *testing.T) { } } +func BenchmarkMerge(b *testing.B) { + ns := newNs() + + for i := 0; i < b.N; i++ { + ns.Merge( + map[string]any{"a": 42, "c": 3, "e": 11}, + map[string]any{"a": 1, "b": 2}, + map[string]any{"a": 9, "c": 4, "d": 7}, + ) + } +} + func TestMergeDataFormats(t *testing.T) { c := qt.New(t) ns := newNs()