mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf: use alloy hash map in trie related code (#12956)
This commit is contained in:
@ -25,7 +25,11 @@ use alloy_eips::{
|
||||
eip4895::{Withdrawal, Withdrawals},
|
||||
BlockHashOrNumber,
|
||||
};
|
||||
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
use alloy_primitives::{
|
||||
keccak256,
|
||||
map::{hash_map, HashMap, HashSet},
|
||||
Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use rayon::slice::ParallelSliceMut;
|
||||
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, EthereumHardforks};
|
||||
@ -71,7 +75,7 @@ use revm::{
|
||||
};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
collections::{hash_map, BTreeMap, BTreeSet, HashMap, HashSet},
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fmt::Debug,
|
||||
ops::{Deref, DerefMut, Range, RangeBounds, RangeInclusive},
|
||||
sync::{mpsc, Arc},
|
||||
@ -2442,7 +2446,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypes> HashingWriter for DatabaseProvi
|
||||
|
||||
// Apply values to HashedState, and remove the account if it's None.
|
||||
let mut hashed_storage_keys: HashMap<B256, BTreeSet<B256>> =
|
||||
HashMap::with_capacity(hashed_storages.len());
|
||||
HashMap::with_capacity_and_hasher(hashed_storages.len(), Default::default());
|
||||
let mut hashed_storage = self.tx.cursor_dup_write::<tables::HashedStorages>()?;
|
||||
for (hashed_address, key, value) in hashed_storages.into_iter().rev() {
|
||||
hashed_storage_keys.entry(hashed_address).or_default().insert(key);
|
||||
|
||||
Reference in New Issue
Block a user