-
Notifications
You must be signed in to change notification settings - Fork 244
perf(rpc): add progressive block trace caching #4021
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6ab7d60
perf(rpc): add progressive block trace caching
danielntmd ff917ed
fix(rpc): preserve feeder initial reads wire format
danielntmd 0c2c855
refactor(rpc): simplify progressive trace caching
danielntmd 2c17da6
perf(rpc): skip unrequested empty-block initial reads allocation
danielntmd 6f499c9
perf(rpc): pass trace cache helper hashes by pointer
danielntmd 6e6b2f2
perf(rpc): reduce temporary trace data copies
danielntmd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Why not return by value? (reduce the extra alloc)
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.
Also, being used only twice, you could consider inlining it. Up to you!
Uh oh!
There was an error while loading. Please reload this page.
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.
rpc/v10/simulation.go:121
InitialReads is a pointer, we could change the field to a value, but then we would need to track absence separately since we currently use nil.
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.
You can return by value and still treated as a pointer via the use of
new(...).Wherever you call
emptyInitialReads()will becomenew(emptyInitialReads())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.
Here are the suggested code shapes and their respective escaped diagnostics and benchmarks.
&readsnew(...)The problem is that both constructions escape through the response returned by
traceFinalisedBlock, so returning by value and wrapping it in new retains allocation. We can avoid this allocation for the empty block path when no reads are requested by leavingInitialReadsasnil, as such:This removes the allocation for unflagged empty-block requests while preserving the external response format. The requested-reads path still allocates, as it did before this PR.