From 39f582f9f43ffefce24a3e162142ed58d7841c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 13 Jan 2025 10:32:41 +0200 Subject: [PATCH] tpl/collections: Add Merge benchmark --- tpl/collections/merge_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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()