-
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
rpc: performance fix for getProgramAccounts #19941
Conversation
The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses.
Optionally these could also be rewritten to use iterators, like
|
I typically prefer this approach, do you mind updating? |
@jstarry Not at all, that's what I did initially, then undid to keep the patch solely about the performance aspect. :) |
lgtm once the checks are fixed, thanks for this! |
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.
Looks like you just need to remove the Ok(..?)
wrappers in two of your iterators, then gtg.
Thanks for this!
Could you elaborate? I'm intentionally making the |
When this is ready, please prepare a version of v1.6.25 with these changes for staging & user testing. Apps are eager to test this out on the large mainnet account set for Serum Program V3. |
e43a369
to
36681ce
Compare
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 again!
Codecov Report
@@ Coverage Diff @@
## master #19941 +/- ##
=========================================
- Coverage 82.6% 82.6% -0.1%
=========================================
Files 478 478
Lines 133443 133545 +102
=========================================
- Hits 110345 110343 -2
- Misses 23098 23202 +104 |
* rpc: performance fix for getProgramAccounts The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses. * rpc: rewrite loops using iterators Co-authored-by: Christian Kamm <[email protected]> (cherry picked from commit f1bbf1d) # Conflicts: # core/src/rpc.rs
* rpc: performance fix for getProgramAccounts The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses. * rpc: rewrite loops using iterators Co-authored-by: Christian Kamm <[email protected]> (cherry picked from commit f1bbf1d)
* rpc: performance fix for getProgramAccounts (#19941) * rpc: performance fix for getProgramAccounts The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses. * rpc: rewrite loops using iterators Co-authored-by: Christian Kamm <[email protected]> (cherry picked from commit f1bbf1d) # Conflicts: # core/src/rpc.rs * fix conflicts * Fix conflicts Co-authored-by: Christian Kamm <[email protected]> Co-authored-by: Justin Starry <[email protected]> Co-authored-by: Tyera Eulberg <[email protected]>
* rpc: performance fix for getProgramAccounts The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses. * rpc: rewrite loops using iterators Co-authored-by: Christian Kamm <[email protected]> (cherry picked from commit f1bbf1d) Co-authored-by: Christian Kamm <[email protected]>
* rpc: performance fix for getProgramAccounts The accounts were gradually pushed into a vector, which produced significant slowdowns for very large responses. * rpc: rewrite loops using iterators Co-authored-by: Christian Kamm <[email protected]>
This reverts commit 05415ce.
Problem
The result accounts were pushed into a fresh vector one-by-one, which produced significant slowdowns for very large responses (visible when exceeding thousands of accounts).
Summary of Changes
Pre-allocate the right capacity - the result length is known.