mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
Don't clone values when calculating storage root (#6108)
* Don't clone values when calculating storage root Instead of cloning all the keys and values of the overlay when calculating the storage root, we pass all the values by reference. This should probably bring some performance improvements when calculating the storage root. * no cow version (#6113) Co-authored-by: cheme <emericchevalier.pro@gmail.com>
This commit is contained in:
@@ -295,7 +295,7 @@ impl Externalities for BasicExternalities {
|
||||
child_info: &ChildInfo,
|
||||
) -> Vec<u8> {
|
||||
if let Some(child) = self.inner.children_default.get(child_info.storage_key()) {
|
||||
let delta = child.data.clone().into_iter().map(|(k, v)| (k, Some(v)));
|
||||
let delta = child.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref())));
|
||||
crate::in_memory_backend::new_in_mem::<Blake2Hasher>()
|
||||
.child_storage_root(&child.child_info, delta).0
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user