Closed atomictag closed 1 month ago
Thank you for your interesing report. I've tried those options.
The size of mcl_c.js
is reduced from 660097 bytes to 622165 bytes with -flto
.
function/usec | no -flto | -flto |
---|---|---|
pairing | 2412.492 | 2086.236 |
millerLoop | 1006.681 | 917.331 |
finalExp | 1334.797 | 1250.731 |
precomputedMillerLoop | 735.137 | 741.364 |
G1::add | 3.084 | 2.855 |
G1::dbl | 2.285 | 2.015 |
G1::mul | 279.962 | 203.932 |
G2::add | 7.657 | 6.774 |
G2::dbl | 3.462 | 3.243 |
G2::mul | 459.43 | 405.152 |
-ffast-math
may improve floating point operations but mcl does not use them.
-s FILESYSTEM=0 -s ASSERTIONS=0
did not change the binary.
So I will append -flto
option.
awesome - and thank you for the new release
Hi there, it's me again :)
I was trying out a few
emcc
options and added the following:then ran some benchmarks (BLS12-381, emcc 3.1.66):
In my tests it appears that
-flto
produces significant improvements on math ops in G1/G2 (and possibly GT).I ran this modified library over 600 complex tests on various algorithms and real-life applications that I have accumulated and encountered no issue. However my focus is solely on BLS12.381 in "Eth mode" so I can't speak for other curves/settings.
But it looks promising!
Other options I have tried
What do you think? 🙏