op-geth/eth
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
..
catalyst all: separate catalyst package (#24280) 2022-01-31 14:22:35 +02:00
downloader core, eth: improve delivery speed on header requests (#23105) 2021-12-07 17:50:58 +01:00
ethconfig all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
fetcher core, miner, rpc, eth: fix goroutine leaks in tests (#24211) 2022-01-21 12:22:44 +01:00
filters eth/filters: remove unused field 'chaindb' in PublicFilterAPI (#24072) 2021-12-07 02:36:01 +01:00
gasprice all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
protocols core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420) 2022-02-18 08:10:26 +01:00
tracers eth/tracers: clean-up tracer collection (#24320) 2022-02-01 10:44:44 +01:00
api.go eth: fix typo in comment (#23941) 2021-11-22 02:53:16 +01:00
api_backend.go all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
api_test.go cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795) 2021-05-12 11:05:39 +03:00
backend.go eth, miner: use miner for post-merge block production (#23256) 2022-01-24 09:19:52 +02:00
bloombits.go eth: move eth.Config to a common package (#22205) 2021-02-05 13:51:15 +01:00
discovery.go cmd/utils: use eth DNS tree for snap discovery (#22808) 2021-05-04 11:29:32 +02:00
handler.go eth: continue after whitelist check 2022-01-07 14:19:00 +01:00
handler_eth.go core, eth, les, trie: remove the sync bloom, used by fast sync 2021-12-03 12:32:41 +02:00
handler_eth_test.go core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420) 2022-02-18 08:10:26 +01:00
handler_snap.go eth: check snap satelliteness, delegate drop to eth (#22235) 2021-02-02 10:44:36 +02:00
handler_test.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
peer.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
peerset.go eth: don't wait for snap registration if we're not running snap (#22272) 2021-02-05 14:15:22 +01:00
state_accessor.go all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
sync.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
sync_test.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00