nim-eth icon indicating copy to clipboard operation
nim-eth copied to clipboard

Implement direct RLP hashing

Open arnetheduck opened this issue 1 year ago • 0 comments

Hashing of RLP is critical for execution client performance and will become even more important when we start using more efficient encodings than RLP in the client.

Currently, to compute the hash of an RLP-encoded item we first serialize the data to a seq[byte] then perform the hashing. This creates a short-lived memory allocation for every hash we compute which is unfortunate and unnecessary.

Instead, we should create a new RlpHashWriter type that keeps a hashing context open and constructs the hash on the fly without writing the bytes to a seq first.

arnetheduck avatar Jun 11 '24 08:06 arnetheduck