erigon-pulse/crypto
Marius van der Wijden 9de5600229 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>
# Conflicts:
#	core/tx_list.go
#	core/tx_pool.go
#	core/types/block.go
#	core/types/transaction.go
#	trie/committer.go
#	trie/hasher.go
2020-08-07 11:46:33 +02:00
..
blake2b crypto/blake2b: fix 386, round 2 2019-08-22 12:24:11 +03:00
bls12381 build, internal/ethapi, crypto/bls12381: fix typos (#21210) 2020-08-07 11:17:36 +02:00
bn256 mobile: add CallOpts.SetFrom (#20721) 2020-03-16 16:40:19 +03:00
ecies geth 1.9.13 (#469) 2020-04-19 18:31:47 +01:00
secp256k1 crypto/secp256k1: enable 128-bit int code and endomorphism optimization (#21203) 2020-08-07 11:21:59 +02:00
crypto_test.go Prevent slice make and copy in Pushes (#625) 2020-06-05 19:46:34 +03:00
crypto.go core: types: less allocations when hashing and tx handling (#21265) 2020-08-07 11:46:33 +02:00
signature_cgo.go Parallel signature verification (#499) 2020-04-29 14:17:28 +03:00
signature_nocgo.go crypto: add SignatureLength constant and use it everywhere (#19996) 2019-08-22 15:14:06 +02:00
signature_test.go Apply Turbo-Geth modifications to go-ethereum codebase 2019-11-01 21:52:03 +01:00