polaris
polaris copied to clipboard
Marshal/Unmarshal of core Geth types is slow
Currently, headers, transactions, and receipts are marshaled/unmarshaled using RLP encoding/decoding, which is quite slow and not specifically useful. Convert to something faster like JSON.
Hi! I would like to try this :D
Awesome, that would be great!
Related - https://github.com/berachain/polaris/issues/388, will benchmark a few alternatives and proceed after review
mashallah @anukul
A few links here which may prove helpful: https://github.com/ethereum/go-ethereum/issues/20786 https://github.com/umbracle/fastrlp https://github.com/vorot93/fastrlp (if there was serious performance improvements, I wouldn't be opposed to using rust, we already have CGO so using FFI is whatever)
We likely lose rlpgen if we swtich to another method, but tbh gpt4 got us covered on that one.
Hey guys, just dropping a quick update -
fastrlp isn't always faster than rlp in my benchmarks.
I have tried to use the same approach as polygon-edge. While there is a possibility that it may not be the most optimal code, I haven't been able to find the source for the quoted benchmark.
I see that Ethereum is moving to SSZ, and it seems faster than RLP for a simpler header struct (linked above).
The go implementation does not work with geth structs out of the box yet, so I'm currently working on that on a fork (specifically this ticket) to move further.