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

sdk: implement AccountSharedData::is_default() #3289

Closed
wants to merge 1 commit into from

Conversation

2501babe
Copy link
Member

@2501babe 2501babe commented Oct 23, 2024

Problem

in #3146, we need to check if an AccountSharedData is equal to the default, but account == AccountSharedData::default() performs a useless heap allocation for the Arc<Vec<u8>> control data

Summary of Changes

implement AccountSharedData::is_default(), which avoids this allocation

(will hold off merging until 2.1 is forked)

@2501babe 2501babe self-assigned this Oct 23, 2024
@2501babe 2501babe marked this pull request as ready for review October 23, 2024 18:28
@2501babe 2501babe requested a review from apfitzge October 23, 2024 18:28
@2501babe
Copy link
Member Author

closing as no longer needed, we can just compare lamports after all. i was being overly cautious, starry points out that there should never be a zero-lamport read-only account to shadow, because the only way an account could get to zero lamports is by being writable, triggering garbage collection

@2501babe 2501babe closed this Oct 29, 2024
@2501babe 2501babe deleted the 20241023_asd_isdefault branch October 29, 2024 08:10
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