Update wasmi (#1119)

* Update wasmi to 0.4.2

* Add simple benchmarks.
This commit is contained in:
Sergey Pepyakin
2018-11-16 17:16:42 +01:00
committed by Gav Wood
parent a4e5842915
commit 5b28147d27
10 changed files with 39 additions and 38 deletions
+19
View File
@@ -17,10 +17,14 @@
//! A `CodeExecutor` specialisation which uses natively compiled runtime when the wasm to be
//! executed is equivalent to the natively compiled code.
#![cfg_attr(feature = "benchmarks", feature(test))]
extern crate node_runtime;
#[macro_use] extern crate substrate_executor;
#[cfg_attr(test, macro_use)] extern crate substrate_primitives as primitives;
#[cfg(feature = "benchmarks")] extern crate test;
#[cfg(test)] extern crate substrate_keyring as keyring;
#[cfg(test)] extern crate sr_primitives as runtime_primitives;
#[cfg(test)] extern crate srml_support as runtime_support;
@@ -747,4 +751,19 @@ mod tests {
assert!(t.storage_changes_root(Default::default(), 0).is_some());
}
#[cfg(feature = "benchmarks")]
mod benches {
use super::*;
use test::Bencher;
#[bench]
fn wasm_execute_block(b: &mut Bencher) {
b.iter(|| {
let mut t = new_test_ext(false);
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "execute_block", &block1(false).0).unwrap();
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "execute_block", &block2().0).unwrap();
});
}
}
}