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

Small optimization over the memory usage of MiMC #435

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

AlexandreBelling
Copy link
Collaborator

@AlexandreBelling AlexandreBelling commented Jul 23, 2023

Description

  • Reset keeps the same buffer
  • tmp is allocated once above the loop (turns out that the allocation is not optimized)

Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm still a bit puzzled that Go didn't optimize the tmp var allocation inside loop.
I tried a very minimal generic version wihout asm methods of encrypt method in godbolt, but it didn't show any difference in the compiled code. But I didn't use the assembly -optimized squaring, so maybe Go cannot optimize then.

@ivokub ivokub merged commit 800ddb5 into Consensys:develop Jul 24, 2023
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

Successfully merging this pull request may close these issues.

2 participants