-
Notifications
You must be signed in to change notification settings - Fork 449
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
7591 abi encoding optimization #7617
7591 abi encoding optimization #7617
Conversation
Hi @LukaszRozmej, The understanding so far - NettyRlpStream uses ReadOnlySpan and dynamic memory allocation of IByteBuffer to efficiently allocate memory. So we either we can reuse that class in ABI encoding, or create a different class. I went with the second approach and created a rather duplicate called NettyAbiStream with same methods with slight differences (it doesn't inherit RlpStream so we can trim off some methods). List of changes ->
Please let me know your thoughts. |
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.
Please ignore this file. Will undo these changes once I have some confirmations from your end.
Hey @LukaszRozmej , awaiting your feedback on 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.
hard to say without example usages, the one for address doesn't do much
if (packed) | ||
{ | ||
nettyAbiStream.Write(input.Bytes.ToList()); | ||
} | ||
else | ||
{ | ||
nettyAbiStream.Write(input.Bytes.PadLeft(UInt256.LengthInBytes).ToList()); | ||
} | ||
return nettyAbiStream.AsSpan().ToArray(); |
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 allocate both list and array, not achieving goal of removing allocations
I understand. Let me go over this again and get back. |
Closing this PR. Starting the work again on a new PR. |
Fixes Closes Resolves #7591
Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Documentation
Requires documentation update
If yes, link the PR to the docs update or the issue with the details labeled
docs
. Remove if not applicable.Requires explanation in Release Notes