From 8e67555219442e22b04f8cde2bb7c3a50c1171d2 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 13 May 2026 11:50:29 +0200 Subject: [PATCH] types: fix benchmark Signed-off-by: Stephan Renatus --- v1/types/types_bench_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/v1/types/types_bench_test.go b/v1/types/types_bench_test.go index 32f3a652a4..7cbadbda96 100644 --- a/v1/types/types_bench_test.go +++ b/v1/types/types_bench_test.go @@ -83,12 +83,13 @@ func BenchmarkAnyUnionAllUniqueTypes(b *testing.B) { tpe := generateTypeWithPrefix(i, "B-") anyB = append(anyB, tpe) } - b.ResetTimer() b.Run(fmt.Sprintf("%dx%d", sizeA, sizeB), func(b *testing.B) { - resultA2B := anyA.Union(anyB) - // Expect length to be A + B - 1, because the `object` type is present in both Any type sets. - if len(resultA2B) != (len(anyA) + len(anyB) - 1) { - b.Fatalf("Expected length of unioned result to be: %d, got: %d", len(anyA)+len(anyB), len(resultA2B)) + for b.Loop() { + resultA2B := anyA.Union(anyB) + // Expect length to be A + B - 1, because the `object` type is present in both Any type sets. + if len(resultA2B) != (len(anyA) + len(anyB) - 1) { + b.Fatalf("Expected length of unioned result to be: %d, got: %d", len(anyA)+len(anyB)-1, len(resultA2B)) + } } }) }