-
Notifications
You must be signed in to change notification settings - Fork 20k
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
core/types: transaction and receipt encoding/decoding optimizations #27976
Merged
Conversation
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
I'm not really sure about these benchmark results. Will rerun on another machine to verify. |
Here are some more stable results. It looks like the effect of this change is very minimal:
|
holiman
reviewed
Aug 23, 2023
This should be ready now. The package rlp change has moved to #27987 |
Since the first three fields of Log are the ones that should appear in the canon encoding, we can simply ignore the remaining fields via struct tag. Doing this removes an indirection through the rlpLog type.
If kind == rlp.Byte, the size reported by Stream.Kind will be zero, but we need a buffer of size 1 for ReadBytes. Since typed txs always have to be longer than 1 byte, we can just return an error for kind == rlp.Byte.
jsvisa
reviewed
Aug 24, 2023
holiman
reviewed
Aug 25, 2023
devopsbo3
pushed a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…thereum#27976) Just some minor optimizations I figured out a while ago. By using ReadBytes instead of Bytes on the rlp stream, we can save the allocation of a temporary buffer for the typed tx payload. If kind == rlp.Byte, the size reported by Stream.Kind will be zero, but we need a buffer of size 1 for ReadBytes. Since typed txs always have to be longer than 1 byte, we can just return an error for kind == rlp.Byte. There is a also a small change for Log: since the first three fields of Log are the ones that should appear in the canon encoding, we can simply ignore the remaining fields via struct tag. Doing this removes an indirection through the rlpLog type. --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…ations (ethereum#27976)" This reverts commit b92d896.
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…ations (ethereum#27976)" This reverts commit b92d896.
sduchesneau
pushed a commit
to streamingfast/go-ethereum
that referenced
this pull request
Feb 26, 2024
core/types: transaction and receipt encoding/decoding optimizations Conflicts: core/types/transaction.go conflict due to us adding a parameter to decodeTyped function. Added both changes.
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.
Just some minor optimizations I figured out a while ago. By using
ReadBytes
instead ofBytes
on the rlp stream, we can save the allocation of a temporary buffer for the typed txpayload.