github.com/cloudflare/circl@v1.5.0/ecc/bls12381/gt_test.go (about) 1 package bls12381 2 3 import ( 4 "crypto/rand" 5 "testing" 6 ) 7 8 func BenchmarkGt(b *testing.B) { 9 sc := &Scalar{} 10 err := sc.Random(rand.Reader) 11 if err != nil { 12 b.Fatal(err) 13 } 14 15 g1 := G1Generator() 16 g2 := G2Generator() 17 e1 := Pair(g1, g2) 18 19 g1.ScalarMult(sc, g1) 20 e2 := Pair(g1, g2) 21 e3 := &Gt{} 22 23 b.Run("Mul", func(b *testing.B) { 24 for i := 0; i < b.N; i++ { 25 e3.Mul(e1, e2) 26 } 27 }) 28 b.Run("Exp", func(b *testing.B) { 29 for i := 0; i < b.N; i++ { 30 e3.Exp(e1, sc) 31 } 32 }) 33 }