Unverified Commit faff980d authored by jwasinger's avatar jwasinger Committed by GitHub

crypto/bls12381: use worst case scalar for input to G1/G2 mul benchmarks (#26447)

* test

* crypto/bls12381: use worst case scalar for input to G1/G2 mul benchmarks
parent ccacb993
...@@ -262,8 +262,9 @@ func BenchmarkG1Add(t *testing.B) { ...@@ -262,8 +262,9 @@ func BenchmarkG1Add(t *testing.B) {
} }
func BenchmarkG1Mul(t *testing.B) { func BenchmarkG1Mul(t *testing.B) {
worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
g1 := NewG1() g1 := NewG1()
a, e, c := g1.rand(), q, PointG1{} a, e, c := g1.rand(), worstCaseScalar, PointG1{}
t.ResetTimer() t.ResetTimer()
for i := 0; i < t.N; i++ { for i := 0; i < t.N; i++ {
g1.MulScalar(&c, a, e) g1.MulScalar(&c, a, e)
......
...@@ -265,8 +265,9 @@ func BenchmarkG2Add(t *testing.B) { ...@@ -265,8 +265,9 @@ func BenchmarkG2Add(t *testing.B) {
} }
func BenchmarkG2Mul(t *testing.B) { func BenchmarkG2Mul(t *testing.B) {
worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
g2 := NewG2() g2 := NewG2()
a, e, c := g2.rand(), q, PointG2{} a, e, c := g2.rand(), worstCaseScalar, PointG2{}
t.ResetTimer() t.ResetTimer()
for i := 0; i < t.N; i++ { for i := 0; i < t.N; i++ {
g2.MulScalar(&c, a, e) g2.MulScalar(&c, a, e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment