Include JSONRPC CLI options.
Bump version numbers. Update Trie benchmarks. Disable RLP benchmark (@debrid please fix).
This commit is contained in:
@@ -3,7 +3,7 @@ description = "Ethcore utility library"
|
||||
homepage = "http://ethcore.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-util"
|
||||
version = "0.1.0"
|
||||
version = "0.9.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
|
||||
[dependencies]
|
||||
@@ -28,4 +28,4 @@ sha3 = { path = "sha3" }
|
||||
serde = "0.6.7"
|
||||
clippy = "0.0.37"
|
||||
json-tests = { path = "json-tests" }
|
||||
target_info = "0.1.0"
|
||||
target_info = "0.1.0"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! ```bash
|
||||
//! multirust run nightly cargo bench
|
||||
//! ```
|
||||
|
||||
/*
|
||||
#![feature(test)]
|
||||
|
||||
extern crate test;
|
||||
@@ -94,3 +94,4 @@ fn bench_stream_1000_empty_lists(b: &mut Bencher) {
|
||||
let _ = stream.out();
|
||||
});
|
||||
}
|
||||
*/
|
||||
@@ -42,6 +42,84 @@ fn random_value(seed: &mut H256) -> Bytes {
|
||||
}
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn trie_insertions_32_mir_1k(b: &mut Bencher) {
|
||||
let st = StandardMap {
|
||||
alphabet: Alphabet::All,
|
||||
min_key: 32,
|
||||
journal_key: 0,
|
||||
value_mode: ValueMode::Mirror,
|
||||
count: 1000,
|
||||
};
|
||||
let d = st.make();
|
||||
let mut hash_count = 0usize;
|
||||
b.iter(&mut ||{
|
||||
let mut memdb = MemoryDB::new();
|
||||
let mut root = H256::new();
|
||||
let mut t = TrieDBMut::new(&mut memdb, &mut root);
|
||||
for i in d.iter() {
|
||||
t.insert(&i.0, &i.1);
|
||||
}
|
||||
hash_count = t.hash_count;
|
||||
});
|
||||
// println!("hash_count: {}", hash_count);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn triehash_insertions_32_mir_1k(b: &mut Bencher) {
|
||||
let st = StandardMap {
|
||||
alphabet: Alphabet::All,
|
||||
min_key: 32,
|
||||
journal_key: 0,
|
||||
value_mode: ValueMode::Mirror,
|
||||
count: 1000,
|
||||
};
|
||||
let d = st.make();
|
||||
b.iter(&mut ||{
|
||||
trie_root(d.clone()).clone();
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn trie_insertions_32_ran_1k(b: &mut Bencher) {
|
||||
let st = StandardMap {
|
||||
alphabet: Alphabet::All,
|
||||
min_key: 32,
|
||||
journal_key: 0,
|
||||
value_mode: ValueMode::Random,
|
||||
count: 1000,
|
||||
};
|
||||
let d = st.make();
|
||||
let mut hash_count = 0usize;
|
||||
let mut r = H256::new();
|
||||
b.iter(&mut ||{
|
||||
let mut memdb = MemoryDB::new();
|
||||
let mut root = H256::new();
|
||||
let mut t = TrieDBMut::new(&mut memdb, &mut root);
|
||||
for i in d.iter() {
|
||||
t.insert(&i.0, &i.1);
|
||||
}
|
||||
hash_count = t.hash_count;
|
||||
r = t.root().clone();
|
||||
});
|
||||
// println!("result: {}", hash_count);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn triehash_insertions_32_ran_1k(b: &mut Bencher) {
|
||||
let st = StandardMap {
|
||||
alphabet: Alphabet::All,
|
||||
min_key: 32,
|
||||
journal_key: 0,
|
||||
value_mode: ValueMode::Random,
|
||||
count: 1000,
|
||||
};
|
||||
let d = st.make();
|
||||
b.iter(&mut ||{
|
||||
trie_root(d.clone()).clone();
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn trie_insertions_six_high(b: &mut Bencher) {
|
||||
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
|
||||
|
||||
@@ -17,12 +17,26 @@ pub enum Alphabet {
|
||||
Custom(Bytes),
|
||||
}
|
||||
|
||||
/// Means of determining the value.
|
||||
pub enum ValueMode {
|
||||
/// Same as the key.
|
||||
Mirror,
|
||||
/// Randomly (50:50) 1 or 32 byte randomly string.
|
||||
Random,
|
||||
}
|
||||
|
||||
/// Standard test map for profiling tries.
|
||||
pub struct StandardMap {
|
||||
alphabet: Alphabet,
|
||||
min_key: usize,
|
||||
journal_key: usize,
|
||||
count: usize,
|
||||
/// The alphabet to use for keys.
|
||||
pub alphabet: Alphabet,
|
||||
/// Minimum size of key.
|
||||
pub min_key: usize,
|
||||
/// Delta size of key.
|
||||
pub journal_key: usize,
|
||||
/// Mode of value generation.
|
||||
pub value_mode: ValueMode,
|
||||
/// Number of keys.
|
||||
pub count: usize,
|
||||
}
|
||||
|
||||
impl StandardMap {
|
||||
@@ -71,7 +85,7 @@ impl StandardMap {
|
||||
Alphabet::Mid => Self::random_word(mid, self.min_key, self.journal_key, &mut seed),
|
||||
Alphabet::Custom(ref a) => Self::random_word(&a, self.min_key, self.journal_key, &mut seed),
|
||||
};
|
||||
let v = Self::random_value(&mut seed);
|
||||
let v = match self.value_mode { ValueMode::Mirror => k.clone(), ValueMode::Random => Self::random_value(&mut seed) };
|
||||
d.push((k, v))
|
||||
}
|
||||
d
|
||||
|
||||
Reference in New Issue
Block a user