go-pulse/crypto
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
..
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-06-10 23:25:32 +03:00
bn256 crypto/bn256: fix import line (#20723) 2020-02-27 13:59:00 +02:00
ecies crypto/ecies: improve concatKDF (#20836) 2020-04-03 11:57:24 +02:00
secp256k1 crypto/secp256k1: enable 128-bit int code and endomorphism optimization (#21203) 2020-06-24 13:51:32 +03:00
crypto_test.go crypto: improve error messages in LoadECDSA (#20718) 2020-04-08 16:01:11 +02:00
crypto.go core: types: less allocations when hashing and tx handling (#21265) 2020-06-30 11:59:06 +02:00
signature_cgo.go crypto: add SignatureLength constant and use it everywhere (#19996) 2019-08-22 15:14:06 +02:00
signature_nocgo.go crypto: add SignatureLength constant and use it everywhere (#19996) 2019-08-22 15:14:06 +02:00
signature_test.go crypto: ensure that VerifySignature rejects malleable signatures (#15708) 2017-12-20 14:30:00 +02:00