-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
wip: limit use of self ref struct in accounts index #34918
Conversation
} | ||
}; | ||
|
||
let slot_list = lock.slot_list(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! We should avoid the clone as much as possible!
Can confirm that this PR eliminates all allocations through ouroboros in my small test ledger. |
There are two other places that will cause the self-ref Arc to be cloned.
solana/accounts-db/src/accounts_db.rs Line 9755 in 0d92254
solana/core/src/accounts_hash_verifier.rs Line 437 in 0d92254
But one of them, Both of them are not big deal. But we may want to add a comment for |
Another place that we will clone the Arc unnecessarily, which can be optimized too!
|
Three more places that can be optimized too!
|
Maybe we should audit all the places this
|
Another idea is that we can change
A quick prototype and a simple test shows that this approach , i.e. ReadAccountMapEntryRef is [Update]
It looks like that we can't return |
Problem
self-ref in accounts index is non-ideal.
Confirmed this gets rid of all but the rare, contentious creation of the self referencing struct.
Note the need to be removed.
Summary of Changes
Fixes #
#34786