• Marius van der Wijden's avatar
    core: types: less allocations when hashing and tx handling (#21265) · ddeea1e0
    Marius van der Wijden authored
    * 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: 's avatarMartin Holst Swende <martin@swende.se>
    ddeea1e0
Name
Last commit
Last update
..
asm Loading commit data...
bloombits Loading commit data...
forkid Loading commit data...
rawdb Loading commit data...
state Loading commit data...
types Loading commit data...
vm Loading commit data...
.gitignore Loading commit data...
bench_test.go Loading commit data...
block_validator.go Loading commit data...
block_validator_test.go Loading commit data...
blockchain.go Loading commit data...
blockchain_insert.go Loading commit data...
blockchain_test.go Loading commit data...
blocks.go Loading commit data...
chain_indexer.go Loading commit data...
chain_indexer_test.go Loading commit data...
chain_makers.go Loading commit data...
chain_makers_test.go Loading commit data...
dao_test.go Loading commit data...
error.go Loading commit data...
events.go Loading commit data...
evm.go Loading commit data...
gaspool.go Loading commit data...
gen_genesis.go Loading commit data...
gen_genesis_account.go Loading commit data...
genesis.go Loading commit data...
genesis_alloc.go Loading commit data...
genesis_test.go Loading commit data...
headerchain.go Loading commit data...
mkalloc.go Loading commit data...
rlp_test.go Loading commit data...
state_prefetcher.go Loading commit data...
state_processor.go Loading commit data...
state_transition.go Loading commit data...
tx_cacher.go Loading commit data...
tx_journal.go Loading commit data...
tx_list.go Loading commit data...
tx_list_test.go Loading commit data...
tx_noncer.go Loading commit data...
tx_pool.go Loading commit data...
tx_pool_test.go Loading commit data...
types.go Loading commit data...