-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Labels
Description
A big part of all reads is encoding and decoding. We should improve our rlp encoding and decoding of trie elements as it seems to be pretty slow and significant (e.g. more than twice the length of db access in some measurements).
The main culprit seems to be allocation.
Some ideas:
- Some implementations of the
RLPEncodetrait encode to calculate the length instead of implementing the recursivelengthfunction. Implementing that function avoids half of the allocations and memcpys of arrays and structs. - We need to check if there are cases where
encode_to_vecin loop that can be replaced withencodeand recycle the buffer. - Sometimes we decode to a vector just so we can iterate. In those cases, we need to test implementing an iterator directly and recycling the buffer.
- Decoding might be able to predict the size of the content in the case of vectors before decoding, so we might be able to avoid pushing and having intermediate allocs.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress