-
Notifications
You must be signed in to change notification settings - Fork 180
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
[EN Performance] Reduce memory used for ledger.Payload by 32+ GB, eliminate 1+ billion allocs/op, speedup various ops #2930
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
74ee21d
Resolve circular dependency
fxamacker b251754
Make ledger.Payload fields unexported
fxamacker e35bd94
Replace decoded payload key with encoded key buf
fxamacker 9ae356c
Merge branch 'master' into fxamacker/use-encoded-key-in-payload
fxamacker 5563418
Add comment for error
fxamacker a596875
Fix test
fxamacker 83f4a13
Fix tests
fxamacker 9a16971
Add custom JSON and CBOR encoding for Payload
fxamacker 581a5d9
Fix lint error
fxamacker 6af8b17
Add tests for ledger.Payload for JSON & CBOR
fxamacker a122da2
Add comment for ledger.Payload
fxamacker 764c68b
Merge branch 'master' into fxamacker/use-encoded-key-in-payload
fxamacker ae5934a
Merge branch 'master' into fxamacker/use-encoded-key-in-payload
fxamacker 209f3ea
Merge branch 'master' into fxamacker/use-encoded-key-in-payload
fxamacker 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 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 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 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 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 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 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 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 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 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.
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.
Is there some inherent structure to KeyParts? Maybe we can convert it to either a Struct or an Array to remove even more dynamic allocations?
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.
@SaveTheRbtz
You're right, the structure of
ledger.Key
can be optimized to reduce number of allocs but it probably won't be worth the effort to do that after I eliminate use ofledger.Key
to just migration and reporting.Ledger key is designed to be flexible, so it can contain variable number of
KeyPart
. But we have plans to limit uses of Ledger key to migration and reports so that we can reduce number of heap allocs.This PR eliminates
ledger.Key
from mtrie leaf nodes' payload.My next PR related to
ledger.Key
is to eliminate it being created outside of migration and reporting which would reduce number of heap allocs caused byledger.Key
.EDIT: add a one-sentence summary to the beginning of my reply and highlight variable names.