erigon-pulse/trie
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
..
rlphacks Restore the functionality CalcTrieRoots (compute trie root without modifying the trie) (#327) 2020-01-30 13:16:12 +00:00
.gitignore Roughly finish with adding BadgerDB (first cut) (#203) 2019-11-27 13:15:25 +00:00
account_node_test.go Use uint256 for account balance (#580) 2020-05-26 17:53:50 +01:00
database.go trie: reduce allocs in insertPreimage (#21261) 2020-08-07 11:22:18 +02:00
debug_test.go Use uint256 for account balance (#580) 2020-05-26 17:53:50 +01:00
debug.go Replace global buff pool by local, because of buffer leaks to larger pools (#739) 2020-07-14 08:56:47 +07:00
delete_subrtee_test.go Use uint256 for account balance (#580) 2020-05-26 17:53:50 +01:00
encoding_test.go Apply Turbo-Geth modifications to go-ethereum codebase 2019-11-01 21:52:03 +01:00
encoding.go Intermediate hash phase 2 (#341) 2020-01-31 14:31:50 +07:00
errors.go Apply Turbo-Geth modifications to go-ethereum codebase 2019-11-01 21:52:03 +01:00
flatdb_sub_trie_loader_test.go Remove incarnation inversion (#755) 2020-07-17 15:18:31 +01:00
flatdb_sub_trie_loader.go Remove incarnation inversion (#755) 2020-07-17 15:18:31 +01:00
gen_struct_step.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
hack.go MGR Schedule v0 (#550) 2020-05-15 15:58:36 +07:00
hashbuilder.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
hasher_test.go Apply Turbo-Geth modifications to go-ethereum codebase 2019-11-01 21:52:03 +01:00
hasher.go core: types: less allocations when hashing and tx handling (#21265) 2020-08-07 11:46:33 +02:00
intermediate_hash_receiver.go Separate Collector pattern out of ETL, hash collector for rebuilding Intermediate Hashes (#597) 2020-05-31 13:23:34 +01:00
intermediate_hashes_test.go Replace global buff pool by local, because of buffer leaks to larger pools (#739) 2020-07-14 08:56:47 +07:00
intermediate_trie_hashes.go Intermediate hash phase 3 (#377) 2020-03-11 10:31:49 +00:00
node_test.go post-rebase fixups v1.9.10 2020-01-30 13:36:30 +02:00
node.go remove mgr feature and stateSize calculation feature (#711) 2020-07-05 07:17:27 +01:00
proof.go Non scalable but correct implementation of eth_getProof (#562) 2020-05-20 15:32:50 +01:00
retain_list_builder.go Rename Resolver => SubTrieLoader, ResolveSet => RetainList (#544) 2020-05-12 15:24:43 +01:00
retain_list.go Revert "Only useful IH cursor (#694)" (#703) 2020-07-02 17:55:35 +07:00
stark_stats.go Use uint256 for account balance (#580) 2020-05-26 17:53:50 +01:00
stream_test.go Fix rebuilding the Intermediate Hash bucket (#602) 2020-06-02 08:46:21 +01:00
stream.go Remove incarnation inversion (#755) 2020-07-17 15:18:31 +01:00
structural_test.go Remove incarnation inversion (#755) 2020-07-17 15:18:31 +01:00
sub_trie_loader.go Separate Collector pattern out of ETL, hash collector for rebuilding Intermediate Hashes (#597) 2020-05-31 13:23:34 +01:00
sync_bloom.go Run tests on lmdb and badger (#624) 2020-06-05 10:25:33 +01:00
trie_binary.go Use binary tries for the stateless action as an option. (#218) 2019-12-04 13:48:38 +01:00
trie_eviction_test.go Code eviction with code nodes support (#416) 2020-04-08 08:00:31 +03:00
trie_eviction.go Code eviction with code nodes support (#416) 2020-04-08 08:00:31 +03:00
trie_from_witness.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
trie_observers_test.go remove mgr feature and stateSize calculation feature (#711) 2020-07-05 07:17:27 +01:00
trie_observers.go remove mgr feature and stateSize calculation feature (#711) 2020-07-05 07:17:27 +01:00
trie_test.go Prepare codebase for future default DB change (#670) 2020-06-16 14:36:16 +01:00
trie_transform.go remove mgr feature and stateSize calculation feature (#711) 2020-07-05 07:17:27 +01:00
trie_witness.go Rename Resolver => SubTrieLoader, ResolveSet => RetainList (#544) 2020-05-12 15:24:43 +01:00
trie.go Remove incarnation inversion (#755) 2020-07-17 15:18:31 +01:00
utils.go refactor trie package a bit (#171) 2019-11-15 17:50:16 +01:00
visual.go remove mgr feature and stateSize calculation feature (#711) 2020-07-05 07:17:27 +01:00
witness_builder_test.go Use uint256 for account balance (#580) 2020-05-26 17:53:50 +01:00
witness_builder.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
witness_marshalling.go New Witness Format (and remove the rest of the tapes) (#317) 2020-01-15 14:56:50 +01:00
witness_operators_test.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
witness_operators.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
witness_stats.go New Witness Format (and remove the rest of the tapes) (#317) 2020-01-15 14:56:50 +01:00
witness_test.go Fix broken witness generation. (#721) 2020-07-07 12:24:55 +01:00
witness.go Use the binary witness format to serialize tries. (#434) 2020-04-08 13:59:30 +01:00
witnessdb_sub_trie_loader_test.go Rename Resolver => SubTrieLoader, ResolveSet => RetainList (#544) 2020-05-12 15:24:43 +01:00
witnessdb_sub_trie_loader.go Rename Resolver => SubTrieLoader, ResolveSet => RetainList (#544) 2020-05-12 15:24:43 +01:00