op-geth/p2p
Felix Lange d6f49bf764
core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420)
This change makes use of the new code generator rlp/rlpgen to improve the
performance of RLP encoding for Header and StateAccount. It also speeds up
encoding of ReceiptForStorage using the new rlp.EncoderBuffer API.

The change is much less transparent than I wanted it to be, because Header and
StateAccount now have an EncodeRLP method defined with pointer receiver. It
used to be possible to encode non-pointer values of these types, but the new
method prevents that and attempting to encode unadressable values (even if
part of another value) will return an error. The error can be surprising and may
pop up in places that previously didn't expect any errors.

To make things work, I also needed to update all code paths (mostly in unit tests)
that lead to encoding of non-pointer values, and pass a pointer instead.

Benchmark results:

    name                             old time/op    new time/op    delta
    EncodeRLP/legacy-header-8           328ns ± 0%     237ns ± 1%   -27.63%  (p=0.000 n=8+8)
    EncodeRLP/london-header-8           353ns ± 0%     247ns ± 1%   -30.06%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8     237ns ± 0%     123ns ± 0%   -47.86%  (p=0.000 n=8+7)
    EncodeRLP/receipt-full-8            297ns ± 0%     301ns ± 1%    +1.39%  (p=0.000 n=8+8)

    name                             old speed      new speed      delta
    EncodeRLP/legacy-header-8        1.66GB/s ± 0%  2.29GB/s ± 1%   +38.19%  (p=0.000 n=8+8)
    EncodeRLP/london-header-8        1.55GB/s ± 0%  2.22GB/s ± 1%   +42.99%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8  38.0MB/s ± 0%  64.8MB/s ± 0%   +70.48%  (p=0.000 n=8+7)
    EncodeRLP/receipt-full-8          910MB/s ± 0%   897MB/s ± 1%    -1.37%  (p=0.000 n=8+8)

    name                             old alloc/op   new alloc/op   delta
    EncodeRLP/legacy-header-8           0.00B          0.00B           ~     (all equal)
    EncodeRLP/london-header-8           0.00B          0.00B           ~     (all equal)
    EncodeRLP/receipt-for-storage-8     64.0B ± 0%      0.0B       -100.00%  (p=0.000 n=8+8)
    EncodeRLP/receipt-full-8             320B ± 0%      320B ± 0%      ~     (all equal)
2022-02-18 08:10:26 +01:00
..
discover all: fix 'the the' in comments (#24036) 2021-12-02 15:42:09 +01:00
dnsdisc p2p/dnsdisc: fix crash when iterator closed before first call to Next (#22906) 2021-05-20 09:24:41 +02:00
enode p2p/enode: store local port number as uint16 (#23926) 2021-11-23 15:14:08 +01:00
enr p2p/enr: reduce allocation in Record.encode (#24034) 2021-12-02 10:55:01 +01:00
msgrate p2p/msgrate: return capacity as integer, clamp to max uint32 (#22943) 2021-05-27 19:43:55 +03:00
nat p2p/nat: skip TestUPNP in non-CI environments if discover fails (#22877) 2021-05-25 22:37:30 +02:00
netutil all: add go:build lines (#23468) 2021-08-25 18:46:29 +02:00
nodestate les/vflux/client, p2p/nodestate: fix data races (#24058) 2021-12-14 11:34:50 +01:00
rlpx p2p/rlpx: reduce allocation and syscalls (#22899) 2021-05-27 10:19:13 +02:00
simulations core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420) 2022-02-18 08:10:26 +01:00
tracker p2p/tracker: only reschedule wake if previous didn't run 2021-04-27 21:47:59 +03:00
dial.go p2p, p2p/enode: fix data races (#23434) 2021-08-24 12:22:56 +02:00
dial_test.go p2p: new dial scheduler (#20592) 2020-02-13 11:10:03 +01:00
message.go eth: implement eth66 (#22241) 2021-02-18 18:54:29 +02:00
message_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
metrics.go eth/protocols, prp/tracker: add support for req/rep rtt tracking (#22608) 2021-04-22 11:42:46 +03:00
peer.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
peer_error.go p2p: fix array out of bounds issue (#23165) 2021-07-06 09:33:51 +02:00
peer_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
protocol.go cmd/devp2p, p2p: dial using node iterator, discovery crawler (#20132) 2019-10-29 17:08:57 +02:00
server.go p2p: reduce the scope of variable dialPubkey (#24385) 2022-02-14 12:05:48 +01:00
server_test.go all: fix warning flagging the use of DeepEqual on error (#23624) 2021-10-19 17:06:47 +02:00
transport.go p2p/rlpx: reduce allocation and syscalls (#22899) 2021-05-27 10:19:13 +02:00
transport_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
util.go p2p: new dial scheduler (#20592) 2020-02-13 11:10:03 +01:00
util_test.go p2p: new dial scheduler (#20592) 2020-02-13 11:10:03 +01:00