Skip to content
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

Optimize ABI API to have less allocation #7591

Open
LukaszRozmej opened this issue Oct 11, 2024 · 2 comments · May be fixed by #7617
Open

Optimize ABI API to have less allocation #7591

LukaszRozmej opened this issue Oct 11, 2024 · 2 comments · May be fixed by #7617

Comments

@LukaszRozmej
Copy link
Member

LukaszRozmej commented Oct 11, 2024

Encoding and Decoding ABI allocates a lot, rewrite it to a version that will allocate a lot less (stream-like or spans?) and update usages.

@ssonthal
Copy link
Contributor

ssonthal commented Oct 13, 2024

Hi @LukaszRozmej can I work on this?

I read a bit about streams and spans. Streams are likely to work better when we have large chunk of data of variable sizes while spans work better with structured fixed-size data and the latter offers better performance enhancement, maintains concurrency in a better way.

What would you suggest is a better approach? I am currently not aware about the data that Abi encoding deals with.

@LukaszRozmej
Copy link
Member Author

Hi @LukaszRozmej can I work on this?

Sure, take a look at: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Abi/AbiEncoder.cs and everything under it (AbiTypes etc). This now allocates a ton of objects when you Decode and ton of byte arrays when you Encode.

Think how can you allocate as little as possible. For inspiration you can check how our Rlp Encoding/Decoding works with NettyRlpStream that is based on pooled memory.

@ssonthal ssonthal linked a pull request Oct 16, 2024 that will close this issue
15 tasks
@NethermindEth NethermindEth deleted a comment Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants