Some changes tries optimizations (#2840)

* changes tries initial optimizations

* line width
This commit is contained in:
Svyatoslav Nikolsky
2019-07-16 04:25:08 +03:00
committed by Gavin Wood
parent 1b5bafc8de
commit 95061beb79
6 changed files with 166 additions and 131 deletions
@@ -17,7 +17,7 @@
//! The overlayed changes to state.
#[cfg(test)] use std::iter::FromIterator;
use std::collections::{HashMap, HashSet};
use std::collections::{HashMap, BTreeSet};
use parity_codec::Decode;
use crate::changes_trie::{NO_EXTRINSIC_INDEX, Configuration as ChangesTrieConfig};
use primitives::storage::well_known_keys::EXTRINSIC_INDEX;
@@ -45,7 +45,7 @@ pub struct OverlayedValue {
pub value: Option<Vec<u8>>,
/// The set of extinsic indices where the values has been changed.
/// Is filled only if runtime has announced changes trie support.
pub extrinsics: Option<HashSet<u32>>,
pub extrinsics: Option<BTreeSet<u32>>,
}
/// Prospective or committed overlayed change set.
@@ -55,7 +55,7 @@ pub struct OverlayedChangeSet {
/// Top level storage changes.
pub top: HashMap<Vec<u8>, OverlayedValue>,
/// Child storage changes.
pub children: HashMap<Vec<u8>, (Option<HashSet<u32>>, HashMap<Vec<u8>, Option<Vec<u8>>>)>,
pub children: HashMap<Vec<u8>, (Option<BTreeSet<u32>>, HashMap<Vec<u8>, Option<Vec<u8>>>)>,
}
#[cfg(test)]