From a2a4166f6db2fcdd28fcd12927c6e049cfdf428c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 13 Jan 2025 10:38:12 +0200 Subject: [PATCH] tpl/collections: Add BenchmarkSortMap --- tpl/collections/sort_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tpl/collections/sort_test.go b/tpl/collections/sort_test.go index 1ec95882f..cc4581921 100644 --- a/tpl/collections/sort_test.go +++ b/tpl/collections/sort_test.go @@ -261,3 +261,11 @@ func TestSort(t *testing.T) { }) } } + +func BenchmarkSortMap(b *testing.B) { + ns := newNs() + m := map[string]int{"1": 10, "2": 20, "3": 30, "4": 40, "5": 50} + for i := 0; i < b.N; i++ { + ns.Sort(context.Background(), m) + } +}