Skip to content
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

Worth consider asmffi asm implementation for pasta fields? #62

Open
CPerezz opened this issue Feb 23, 2023 · 0 comments
Open

Worth consider asmffi asm implementation for pasta fields? #62

CPerezz opened this issue Feb 23, 2023 · 0 comments

Comments

@CPerezz
Copy link

CPerezz commented Feb 23, 2023

I came across https://github.com/iden3/ffiasm and wondered if this asm code has ever been benched against the actual implementation. And if so, whether it is faster.

I did some initial exploration and saw that most of the asm backend we have at PSE (see here) is as optimized as what rust here compiles too. (At least for fns like double as seen in: #44 (comment)

From a quick look, to functions like double or square looks like the exact same thing or even slightly worse:

Square

Instruction asmffi PSE-ASM (Ash)
PUSH 4 0
MOV 20 19
XOR 1 2
MULX 36 36
ADCX 39 28
ADOX 28 0
BT 2 0
SHL 1 0
ADD 2 28
SUB 2 2
SBB 0 6
CMOVC 0 8
TOTAL 135 129

Double

From a superficial view is already obvious that PSE-ASM is has less ops.


So I just wonder if anyone has done a deep analysis on that. As from a short check, looks like is not worth even considering it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant