alt_bn128_pair performance too slow
Closed this issue · 5 comments
jafri commented
input:
[15,37,146,155,203,67,213,165,115,145,86,70,21,201,231,10,153,43,16,234,250,77,177,9,112,150,73,207,72,197,13,210,22,218,47,92,182,190,122,10,167,44,68,12,83,201,187,223,236,108,54,199,213,21,83,100,49,179,168,101,70,138,203,186,46,137,113,138,211,60,139,237,146,226,16,232,29,24,83,67,83,153,162,113,145,58,101,32,115,106,71,41,207,13,81,235,1,169,226,255,162,233,37,153,182,142,68,222,91,207,53,79,162,100,43,212,242,107,37,157,170,111,124,227,237,87,174,179,20,169,168,123,120,154,88,175,73,155,49,78,19,195,214,91,237,229,108,7,234,45,65,141,104,116,133,123,112,118,55,19,23,143,180,154,45,108,211,71,220,88,151,63,244,150,19,162,7,87,208,252,194,32,121,249,171,209,12,59,174,226,69,144,27,158,2,123,213,207,194,203,93,184,45,77,201,103,122,199,149,236,80,14,205,71,222,238,59,93,160,6,214,208,73,184,17,215,81,28,120,21,141,228,132,35,47,198,141,175,138,69,207,33,125,28,47,174,105,63,245,135,30,135,82,215,59,33,25,142,147,147,146,13,72,58,114,96,191,183,49,251,93,37,241,170,73,51,53,169,231,18,151,228,133,183,174,243,18,194,24,0,222,239,18,31,30,118,66,106,0,102,94,92,68,121,103,67,34,212,247,94,218,221,70,222,189,92,217,146,246,237,9,6,137,208,88,95,240,117,236,158,153,173,105,12,51,149,188,75,49,51,112,179,142,243,85,172,218,220,209,34,151,91,18,200,94,165,219,140,109,235,74,171,113,128,141,203,64,143,227,209,231,105,12,67,211,123,76,230,204,1,102,250,125,170]
Takes 8-10ms per pair on jungle, might be worth optimizing if possible
linh2931 commented
@jafri Did you directly call FC's alt_bn128_pair
or use the host function alt_bn128_pair
? I am going to reproduce the problem at our side.
jafri commented
Through compiled contract, not FC
linh2931 commented
@jafri I benchmarked FC
, Go
, and Rust
pairing functions (please see details in #780). FC
paring is about 4 ms.
I am going to reproduce your results via contracts. I plan to base on our unittest code but would like to use the methods as close as possible to yours for the numbers.
- What are your hardware configurations?
- I don't understand your input
[15,37,146,155,203,67,213,165,115,145 ...
. How are they mapped to the input to host functionalt_bn128_pair
? - What contract are you using?
- Is it possible to share your benchmarking scripts?
Thanks.
jafri commented
Pass that data to the intrinsic alt_bn128_pair
inside any smart contract
spoonincode commented
Performance has been substantially improved in 4.0 via AntelopeIO/leap#461