go-ethereum/eth
Marius van der Wijden ddeea1e0c6
core: types: less allocations when hashing and tx handling (#21265)
* core, crypto: various allocation savings regarding tx handling

* core: reduce allocs for gas price comparison

This change reduces the allocations needed for comparing different transactions to each other.
A call to `tx.GasPrice()` copies the gas price as it has to be safe against modifications and
also needs to be threadsafe. For comparing and ordering different transactions we don't need
these guarantees

* core: added tx.GasPriceIntCmp for comparison without allocation

adds a method to remove unneeded allocation in comparison to tx.gasPrice

* core/types: pool legacykeccak256 objects in rlpHash

rlpHash is by far the most used function in core that allocates a legacyKeccak256 object on each call.
Since it is so widely used it makes sense to add pooling here so we relieve the GC.
On my machine these changes result in > 100 MILLION less allocations and > 30 GB less allocated memory.

* reverted some changes

* reverted some changes

* trie: use crypto.KeccakState instead of replicating code

Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-06-30 11:59:06 +02:00
..
downloader eth/downloader: don't use defer for unlock before return (#21227) 2020-06-15 15:46:27 +03:00
fetcher core, eth, internal: include read storage entries in structlog output (#21204) 2020-06-10 11:46:13 +02:00
filters all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00
gasprice core: types: less allocations when hashing and tx handling (#21265) 2020-06-30 11:59:06 +02:00
tracers core/vm: use uint256 in EVM implementation (#20787) 2020-06-08 15:24:40 +03:00
api.go eth: add debug_accountRange API (#19645) 2020-03-31 12:08:44 +02:00
api_backend.go cmd, eth, internal, les: add txfee cap (#21212) 2020-06-17 10:46:31 +03:00
api_test.go eth: add debug_accountRange API (#19645) 2020-03-31 12:08:44 +02:00
api_tracer.go eth: returned revert reason in traceTx (#21195) 2020-06-26 12:19:31 +02:00
backend.go les, les/lespay: implement new server pool (#20758) 2020-05-22 13:46:34 +02:00
bloombits.go eth: improve shutdown synchronization (#20695) 2020-03-27 15:03:20 +02:00
config.go cmd, eth, internal, les: add txfee cap (#21212) 2020-06-17 10:46:31 +03:00
discovery.go cmd/geth: enable DNS discovery by default (#20660) 2020-02-13 15:38:30 +02:00
gen_config.go cmd, eth, internal, les: add txfee cap (#21212) 2020-06-17 10:46:31 +03:00
handler.go eth: don't block if transaction broadcast loop fails (#21255) 2020-06-24 13:54:13 +03:00
handler_test.go cmd, core, eth: background transaction indexing (#20302) 2020-05-11 18:58:43 +03:00
helper_test.go cmd, core, eth: background transaction indexing (#20302) 2020-05-11 18:58:43 +03:00
peer.go eth: don't block if transaction broadcast loop fails (#21255) 2020-06-24 13:54:13 +03:00
protocol.go eth: rework tx fetcher to use O(1) ops + manage network requests 2020-02-13 15:27:15 +02:00
protocol_test.go cmd, core, eth: background transaction indexing (#20302) 2020-05-11 18:58:43 +03:00
sync.go eth: interrupt chain insertion on shutdown (#21114) 2020-05-26 21:37:37 +02:00
sync_test.go eth: improve shutdown synchronization (#20695) 2020-03-27 15:03:20 +02:00