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

A close macro implementation for AccountInfo #42

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Conversation

L0STE
Copy link
Contributor

@L0STE L0STE commented Nov 17, 2024

PRd this macro implementation invented by @deanmlittle (known as based_close) in the Pinocchio AccountInfo implementation to use it more easily.

I added 2 different function + docs:

  • .close(): the implementation with pointer of the underlying idea
  • .optimized_close(): the implementation with assembly of the underlying idea (marked the implementation as unsafe function since it uses asm_experimental_arch

Some data about the CU usage:

  • .close(): takes 60 CUs
  • .optimized_close(): takes 7 CUs

Edit: now close has 7CUs as well (thanks to @febo's comment) and optimized_close() is now called assembly_close()

Copy link
Owner

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks great – left a couple of suggestions.

@febo febo merged commit 74b5512 into febo:main Nov 20, 2024
3 checks passed
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