Reuse buffered reader with overflow across full accounts storage scans#7080
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7080 +/- ##
=========================================
- Coverage 83.2% 83.2% -0.1%
=========================================
Files 796 796
Lines 361923 361996 +73
=========================================
+ Hits 301346 301394 +48
- Misses 60577 60602 +25 🚀 New features to boost your workflow:
|
f984c6a to
6c0a181
Compare
|
|
HaoranYi
previously approved these changes
Jul 31, 2025
HaoranYi
left a comment
There was a problem hiding this comment.
lgtm. Reusing buffers instead of creating new ones for each storage seems reasonable.
brooksprumo
reviewed
Aug 5, 2025
730ed5f to
df6f178
Compare
Author
True, I try to avoid it, but with some of these changes conflicts pop up quite often and today there was a really painful issue with CI, so I rebased on pick up a fix and let the CI pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Currently full accounts scan creates buffered reader with overflow capacity for each storage and discards it after that storage is done processing. This also drops any additional state or work that might have been done by the reader implementation - none is done by current
BufferedReader, but it prevents us from using multi-file read-ahead implementation ofFileBufReadthere.Summary of Changes
&Filefrom mandatory args ofBufferedReaderconstructore, useOption<&file>in reader stateset_file(file: &File, read_limit: usize)function toFileBufReadtrait - this activates the file to be read from and resets buffer state and file offsetReusing the reader saves some allocations made when reading large accounts data, but it is in-frequent enough that this PR is performance neutral: