Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions internal/stats/latest_stats.csv
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,24 @@ pairing_bn254,bn254,groth16,506052,823961
pairing_bn254,bn254,plonk,1646819,1573151
pairing_bw6761,bn254,groth16,1589471,2646707
pairing_bw6761,bn254,plonk,5318762,5097941
scalar_mul_G1_bn254,bn254,groth16,115934,175413
scalar_mul_G1_bn254,bn254,plonk,381171,365027
scalar_mul_G1_bn254_incomplete,bn254,groth16,55441,87984
scalar_mul_G1_bn254_incomplete,bn254,plonk,200004,192882
scalar_mul_G1_bn254,bn254,groth16,108168,163915
scalar_mul_G1_bn254,bn254,plonk,355353,340385
scalar_mul_G1_bn254_incomplete,bn254,groth16,51579,81902
scalar_mul_G1_bn254_incomplete,bn254,plonk,185916,179316
scalar_mul_G2_bls12381,bn254,groth16,138129,216643
scalar_mul_G2_bls12381,bn254,plonk,481714,463233
scalar_mul_G2_bn254,bn254,groth16,102279,158428
scalar_mul_G2_bn254,bn254,plonk,349799,336420
scalar_mul_G2_bw6761,bn254,groth16,191105,296444
scalar_mul_G2_bw6761,bn254,plonk,659865,637514
scalar_mul_P256,bn254,groth16,96724,151768
scalar_mul_P256,bn254,plonk,328895,315729
scalar_mul_P256_incomplete,bn254,groth16,75542,121798
scalar_mul_P256_incomplete,bn254,plonk,263160,253523
scalar_mul_secp256k1,bn254,groth16,117264,177389
scalar_mul_secp256k1,bn254,plonk,385623,369279
scalar_mul_secp256k1_incomplete,bn254,groth16,56125,89066
scalar_mul_secp256k1_incomplete,bn254,plonk,202518,195302
scalar_mul_secp256k1,bn254,groth16,108204,163975
scalar_mul_secp256k1,bn254,plonk,355502,340530
scalar_mul_secp256k1_incomplete,bn254,groth16,51619,81970
scalar_mul_secp256k1_incomplete,bn254,plonk,186082,179475
selector/binaryMux_4,bn254,groth16,5,3
selector/binaryMux_4,bls12_377,groth16,5,3
selector/binaryMux_4,bls12_381,groth16,5,3
Expand Down
83 changes: 83 additions & 0 deletions internal/stats/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,89 @@ func initSnippets() {

}, ecc.BN254)

// G2 scalar mul snippets — exercise the GLV+FakeGLV path to track its cost.
registerSnippet("scalar_mul_G2_bls12381", func(api frontend.API, newVariable func() frontend.Variable) {
bls12381fp, _ := emulated.NewField[emulated.BLS12381Fp](api)
newFp := func() *emulated.Element[emulated.BLS12381Fp] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BLS12381Fp](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bls12381fp.NewElement(limbs)
}
bls12381fr, _ := emulated.NewField[emulated.BLS12381Fr](api)
newFr := func() *emulated.Element[emulated.BLS12381Fr] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BLS12381Fr](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bls12381fr.NewElement(limbs)
}
g2, _ := sw_bls12381.NewG2(api)
var dummyQ sw_bls12381.G2Affine
dummyQ.P.X.A0 = *newFp()
dummyQ.P.X.A1 = *newFp()
dummyQ.P.Y.A0 = *newFp()
dummyQ.P.Y.A1 = *newFp()
_ = g2.ScalarMul(&dummyQ, newFr())
}, ecc.BN254)

registerSnippet("scalar_mul_G2_bn254", func(api frontend.API, newVariable func() frontend.Variable) {
bn254fp, _ := emulated.NewField[emulated.BN254Fp](api)
newFp := func() *emulated.Element[emulated.BN254Fp] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BN254Fp](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bn254fp.NewElement(limbs)
}
bn254fr, _ := emulated.NewField[emulated.BN254Fr](api)
newFr := func() *emulated.Element[emulated.BN254Fr] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BN254Fr](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bn254fr.NewElement(limbs)
}
g2, _ := sw_bn254.NewG2(api)
var dummyQ sw_bn254.G2Affine
dummyQ.P.X.A0 = *newFp()
dummyQ.P.X.A1 = *newFp()
dummyQ.P.Y.A0 = *newFp()
dummyQ.P.Y.A1 = *newFp()
_ = g2.ScalarMul(&dummyQ, newFr())
}, ecc.BN254)

registerSnippet("scalar_mul_G2_bw6761", func(api frontend.API, newVariable func() frontend.Variable) {
bw6fp, _ := emulated.NewField[emulated.BW6761Fp](api)
newFp := func() *emulated.Element[emulated.BW6761Fp] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BW6761Fp](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bw6fp.NewElement(limbs)
}
bw6fr, _ := emulated.NewField[emulated.BW6761Fr](api)
newFr := func() *emulated.Element[emulated.BW6761Fr] {
nbLimbs, _ := emulated.GetEffectiveFieldParams[emulated.BW6761Fr](api.Compiler().Field())
limbs := make([]frontend.Variable, nbLimbs)
for i := range limbs {
limbs[i] = newVariable()
}
return bw6fr.NewElement(limbs)
}
g2, _ := sw_bw6761.NewG2(api)
var dummyQ sw_bw6761.G2Affine
dummyQ.P.X = *newFp()
dummyQ.P.Y = *newFp()
_ = g2.ScalarMul(&dummyQ, newFr())
}, ecc.BN254)

registerSnippet("selector/mux_3", func(api frontend.API, newVariable func() frontend.Variable) {
selector.Mux(api, newVariable(), newVariable(), newVariable(), newVariable())
})
Expand Down
Loading
Loading