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 <stephan.renatus@gmail.com>
This commit is contained in:
Stephan Renatus
2026-06-10 10:39:44 +02:00
committed by Stephan Renatus
parent 6f52916ab1
commit 7750005131
2 changed files with 2 additions and 14 deletions
@@ -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)
}
}
-12
View File
@@ -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"},