• Qian Bin's avatar
    rlp, trie: faster trie node encoding (#24126) · 65ed1a68
    Qian Bin authored
    This change speeds up trie hashing and all other activities that require
    RLP encoding of trie nodes by approximately 20%. The speedup is achieved by
    avoiding reflection overhead during node encoding.
    
    The interface type trie.node now contains a method 'encode' that works with
    rlp.EncoderBuffer. Management of EncoderBuffers is left to calling code.
    trie.hasher, which is pooled to avoid allocations, now maintains an
    EncoderBuffer. This means memory resources related to trie node encoding
    are tied to the hasher pool.
    Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
    65ed1a68
encode.go 12.1 KB