From 775000513136f6db99cf398d2f228d866621e02c Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 10 Jun 2026 10:39:44 +0200 Subject: [PATCH] benchmarks: smaller tweaks The crypto benchmark was allocating Bytes() in the b.Loop(), and there's no need for that. The semver benchmark had some duplicate fixtures. Signed-off-by: Stephan Renatus --- internal/providers/aws/crypto/compare_test.go | 4 ++-- internal/semver/semver_test.go | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/internal/providers/aws/crypto/compare_test.go b/internal/providers/aws/crypto/compare_test.go index 9fce672b7c..38cb97a41b 100644 --- a/internal/providers/aws/crypto/compare_test.go +++ b/internal/providers/aws/crypto/compare_test.go @@ -36,9 +36,9 @@ func TestConstantTimeByteCompare(t *testing.T) { } func BenchmarkConstantTimeCompare(b *testing.B) { - x, y := big.NewInt(1023), big.NewInt(1024) + x, y := big.NewInt(1023).Bytes(), big.NewInt(1024).Bytes() for b.Loop() { - _, _ = ConstantTimeByteCompare(x.Bytes(), y.Bytes()) + _, _ = ConstantTimeByteCompare(x, y) } } diff --git a/internal/semver/semver_test.go b/internal/semver/semver_test.go index b49b2c6339..fbf0268c89 100644 --- a/internal/semver/semver_test.go +++ b/internal/semver/semver_test.go @@ -33,18 +33,6 @@ type ( var ( fixtures = []fixture{ - {"0.0.0", "0.0.0-foo"}, - {"0.0.1", "0.0.0"}, - {"1.0.0", "0.9.9"}, - {"0.10.0", "0.9.0"}, - {"0.99.0", "0.10.0"}, - {"2.0.0", "1.2.3"}, - {"0.0.0", "0.0.0-foo"}, - {"0.0.1", "0.0.0"}, - {"1.0.0", "0.9.9"}, - {"0.10.0", "0.9.0"}, - {"0.99.0", "0.10.0"}, - {"2.0.0", "1.2.3"}, {"0.0.0", "0.0.0-foo"}, {"0.0.1", "0.0.0"}, {"1.0.0", "0.9.9"},