-
Notifications
You must be signed in to change notification settings - Fork 29
feat: added new account indexes #151
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
Conversation
The optimization idea is solid, but I'm not a big fan of introducing multiple new hash maps that store owned Pubkey values both as keys and within their entries—especially since many of these values will end up duplicated or even triplicated. For example the
Assuming |
Agreed on the downsides, @LevBeta, but this will work for now. Any suggestions for future optimizations on this approach? |
@MicaiahReid 2: if we going to be frequently checking for duplicates, we can use HashSet instead of Vec for the indexes. This makes duplicate checking O(1) instead of O(n). (not a blocker at all just a suggestion) |
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.
LGTM, @Ozodimgba!
One small thing is that we are only parsing token accounts, not token 2022. Would be an easy thing for me to add later, so I'd rather not block.
Also you've just got some merge conflicts to resolve since your other PR was merged!
@MicaiahReid resolved here on github...it should build sucessfully. If it doesnt will just sort it out first thing tomorrow before I commit the other endpoints on WIP |
@lgalabru need you to review this so it can get merged...I need it for the token endpoints |
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.
Thanks @Ozodimgba 🙏
This Draft aim to replace the current single account_registry with multiple specialized indexes to enable fast lookups of token accounts by owner, delegate, and mint without duplicating account data in memory following @MicaiahReid.
Problem
The current implementation has limitations when querying token accounts:
Missing Token Queries: No efficient way to find token accounts by delegate or mint
Slow Lookups: Would require iterating through all accounts to find specific token accounts
Solution
Replace the single registry with multiple specialized indexes that store accounts once and provide fast lookups: