Skip to content

Small optimization over the memory usage of MiMC#435

Merged
ivokub merged 1 commit intoConsensys:developfrom
AlexandreBelling:perf/mem-optim-mimc
Jul 24, 2023
Merged

Small optimization over the memory usage of MiMC#435
ivokub merged 1 commit intoConsensys:developfrom
AlexandreBelling:perf/mem-optim-mimc

Conversation

@AlexandreBelling
Copy link
Copy Markdown
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
Copy Markdown
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