• Felix Lange's avatar
    rlp: improve decoder stream implementation (#22858) · 088da24e
    Felix Lange authored
    This commit makes various cleanup changes to rlp.Stream.
    
    * rlp: shrink Stream struct
    
    This removes a lot of unused padding space in Stream by reordering the
    fields. The size of Stream changes from 120 bytes to 88 bytes. Stream
    instances are internally cached and reused using sync.Pool, so this does
    not improve performance.
    
    * rlp: simplify list stack
    
    The list stack kept track of the size of the current list context as
    well as the current offset into it. The size had to be stored in the
    stack in order to subtract it from the remaining bytes of any enclosing
    list in ListEnd. It seems that this can be implemented in a simpler
    way: just subtract the size from the enclosing list context in List instead.
    088da24e
decode.go 27.4 KB