-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use BMI2 when the CPU supports it for certain field element operations #38
base: master
Are you sure you want to change the base?
Conversation
``` name old time/op new time/op delta Mul-8 36.8ns ± 0% 31.6ns ± 0% -14.04% (p=0.008 n=5+5) ```
This requires changing the registers used for feSquare, but it removes a gigantic block of functionally equivalent assembly.
``` name old time/op new time/op delta Square-8 29.0ns ± 2% 26.5ns ± 0% -8.63% (p=0.008 n=5+5) ```
Hi @Yawning! Two quick questions. First, we did a bunch of work on the field implementation getting it into filippo.io/edwards25519, and eventually I am hoping to replace the guts of this package with that. Would you consider contributing these changes there? I am trying to keep that repository CLA-clean to upstream it into Go, as well, so it would involve signing the Go CLA and agreeing to submit this code as a contribution to Go. Second, do you have any higher level benchmarks, ideally through benchstat, so we can evaluate if the extra code complexity is worth it? |
I would need to check with my employer, since this is lifted out of code that I wrote for them.
I assume ed25519 benchmarks will suffice as a high level comparison. The host is a i7-10510U, with turbo disabled via
Note: Benchmarks taken with the code I lifted the assembly out of. The only major difference would be that the original code implements |
Square is almost not worth it, though it may be worth investigating if it is possible to use ADCX/ADOX to make both Mul and Square faster (Isn't registry pressure fun?). Unfortunately the stub ends up being somewhat ugly, but having to fight with the inliner shouldn't come as a surprise at this point.