• Felix Lange's avatar
    rlp: optimize big.Int decoding for size <= 32 bytes (#22927) · 4d33de9b
    Felix Lange authored
    This change grows the static integer buffer in Stream to 32 bytes,
    making it possible to decode 256bit integers without allocating a
    temporary buffer.
    
    In the recent commit 088da24e, Stream struct size decreased from 120
    bytes down to 88 bytes. This commit grows the struct to 112 bytes again,
    but the size change will not degrade performance because Stream
    instances are internally cached in sync.Pool.
    
        name             old time/op    new time/op    delta
        DecodeBigInts-8    12.2µs ± 0%     8.6µs ± 4%  -29.58%  (p=0.000 n=9+10)
    
        name             old speed      new speed      delta
        DecodeBigInts-8   230MB/s ± 0%   326MB/s ± 4%  +42.04%  (p=0.000 n=9+10)
    4d33de9b
decode_test.go 32.5 KB