mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
contracts: Follow up for benchmark simplification (#13635)
* Rename BATCHES -> RUNS * Reduce runs of slow benchmarks * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts --------- Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
87197b094f
commit
27ccf17db5
@@ -45,18 +45,18 @@ use sp_runtime::{
|
||||
use sp_std::prelude::*;
|
||||
use wasm_instrument::parity_wasm::elements::{BlockType, BrTableData, Instruction, ValueType};
|
||||
|
||||
/// How many batches we do per API benchmark.
|
||||
/// How many runs we do per API benchmark.
|
||||
///
|
||||
/// This is picked more or less arbitrary. We experimented with different numbers until
|
||||
/// the results appeared to be stable. Reducing the number would speed up the benchmarks
|
||||
/// but might make the results less precise.
|
||||
const API_BENCHMARK_BATCHES: u32 = 1600;
|
||||
const API_BENCHMARK_RUNS: u32 = 1600;
|
||||
|
||||
/// How many batches we do per instruction benchmark.
|
||||
/// How many runs we do per instruction benchmark.
|
||||
///
|
||||
/// Same rationale as for [`API_BENCHMARK_BATCHES`]. The number is bigger because instruction
|
||||
/// Same rationale as for [`API_BENCHMARK_RUNS`]. The number is bigger because instruction
|
||||
/// benchmarks are faster.
|
||||
const INSTR_BENCHMARK_BATCHES: u32 = 5000;
|
||||
const INSTR_BENCHMARK_RUNS: u32 = 5000;
|
||||
|
||||
/// An instantiated and deployed contract.
|
||||
struct Contract<T: Config> {
|
||||
@@ -425,7 +425,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_caller {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_caller", r
|
||||
), vec![])?;
|
||||
@@ -434,7 +434,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_is_contract {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let accounts = (0 .. r)
|
||||
.map(|n| account::<T::AccountId>("account", n, 0))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -472,7 +472,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let accounts = (0 .. r)
|
||||
.map(|n| account::<T::AccountId>("account", n, 0))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -518,7 +518,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_own_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_own_code_hash", r
|
||||
), vec![])?;
|
||||
@@ -527,7 +527,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_caller_is_origin {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -548,7 +548,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_address {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_address", r
|
||||
), vec![])?;
|
||||
@@ -557,7 +557,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_gas_left {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_gas_left", r
|
||||
), vec![])?;
|
||||
@@ -566,7 +566,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_balance {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_balance", r
|
||||
), vec![])?;
|
||||
@@ -575,7 +575,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_value_transferred {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_value_transferred", r
|
||||
), vec![])?;
|
||||
@@ -584,7 +584,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_minimum_balance {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_minimum_balance", r
|
||||
), vec![])?;
|
||||
@@ -593,7 +593,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_block_number {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_block_number", r
|
||||
), vec![])?;
|
||||
@@ -602,7 +602,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_now {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
"seal0", "seal_now", r
|
||||
), vec![])?;
|
||||
@@ -611,7 +611,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_weight_to_fee {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let pages = code::max_pages::<T>();
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
@@ -639,7 +639,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_gas {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
imported_functions: vec![ImportedFunction {
|
||||
module: "seal0",
|
||||
@@ -660,7 +660,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_input {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -815,7 +815,7 @@ benchmarks! {
|
||||
// used.
|
||||
#[pov_mode = Measured]
|
||||
seal_random {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let pages = code::max_pages::<T>();
|
||||
let subject_len = T::Schedule::get().limits.subject_len;
|
||||
assert!(subject_len < 1024);
|
||||
@@ -850,7 +850,7 @@ benchmarks! {
|
||||
// We benchmark for the worst case (largest event).
|
||||
#[pov_mode = Measured]
|
||||
seal_deposit_event {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -914,7 +914,7 @@ benchmarks! {
|
||||
// against an excessive use.
|
||||
#[pov_mode = Measured]
|
||||
seal_debug_message {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory { min_pages: 1, max_pages: 1 }),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -1009,7 +1009,7 @@ benchmarks! {
|
||||
#[skip_meta]
|
||||
#[pov_mode = Measured]
|
||||
seal_set_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let r in 0 .. API_BENCHMARK_RUNS/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
let keys = (0 .. r)
|
||||
.map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec();
|
||||
@@ -1143,11 +1143,11 @@ benchmarks! {
|
||||
// Similar to seal_set_storage. We store all the keys that we are about to
|
||||
// delete beforehand in order to prevent any optimizations that could occur when
|
||||
// deleting a non existing key. We generate keys of a maximum length, and have to
|
||||
// reduce batch size in order to make resulting contract code size less than MaxCodeLen.
|
||||
// the amount of runs in order to make resulting contract code size less than MaxCodeLen.
|
||||
#[skip_meta]
|
||||
#[pov_mode = Measured]
|
||||
seal_clear_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let r in 0 .. API_BENCHMARK_RUNS/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
let keys = (0 .. r)
|
||||
.map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec();
|
||||
@@ -1236,7 +1236,7 @@ benchmarks! {
|
||||
#[skip_meta]
|
||||
#[pov_mode = Measured]
|
||||
seal_get_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let r in 0 .. API_BENCHMARK_RUNS/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
let keys = (0 .. r)
|
||||
.map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec();
|
||||
@@ -1339,7 +1339,7 @@ benchmarks! {
|
||||
#[skip_meta]
|
||||
#[pov_mode = Measured]
|
||||
seal_contains_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let r in 0 .. API_BENCHMARK_RUNS/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
let keys = (0 .. r)
|
||||
.map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec();
|
||||
@@ -1429,7 +1429,7 @@ benchmarks! {
|
||||
#[skip_meta]
|
||||
#[pov_mode = Measured]
|
||||
seal_take_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let r in 0 .. API_BENCHMARK_RUNS/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
let keys = (0 .. r)
|
||||
.map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec();
|
||||
@@ -1531,7 +1531,7 @@ benchmarks! {
|
||||
// We transfer to unique accounts.
|
||||
#[pov_mode = Measured]
|
||||
seal_transfer {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let accounts = (0..r)
|
||||
.map(|i| account::<T::AccountId>("receiver", i, 0))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1583,9 +1583,11 @@ benchmarks! {
|
||||
}
|
||||
|
||||
// We call unique accounts.
|
||||
//
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
#[pov_mode = Measured]
|
||||
seal_call {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS / 2;
|
||||
let dummy_code = WasmModule::<T>::dummy_with_bytes(0);
|
||||
let callees = (0..r)
|
||||
.map(|i| Contract::with_index(i + 1, dummy_code.clone(), vec![]))
|
||||
@@ -1642,9 +1644,10 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
#[pov_mode = Measured]
|
||||
seal_delegate_call {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS / 2;
|
||||
let hashes = (0..r)
|
||||
.map(|i| {
|
||||
let code = WasmModule::<T>::dummy_with_bytes(i);
|
||||
@@ -1751,9 +1754,10 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, bytes)
|
||||
|
||||
// We assume that every instantiate sends at least the minimum balance.
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
#[pov_mode = Measured]
|
||||
seal_instantiate {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS / 2;
|
||||
let hashes = (0..r)
|
||||
.map(|i| {
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -1939,7 +1943,7 @@ benchmarks! {
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_sha2_256 {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
"seal_hash_sha2_256", r, 0,
|
||||
), vec![])?;
|
||||
@@ -1959,7 +1963,7 @@ benchmarks! {
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_keccak_256 {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
"seal_hash_keccak_256", r, 0,
|
||||
), vec![])?;
|
||||
@@ -1979,7 +1983,7 @@ benchmarks! {
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_256 {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
"seal_hash_blake2_256", r, 0,
|
||||
), vec![])?;
|
||||
@@ -1999,7 +2003,7 @@ benchmarks! {
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_128 {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
"seal_hash_blake2_128", r, 0,
|
||||
), vec![])?;
|
||||
@@ -2018,9 +2022,10 @@ benchmarks! {
|
||||
|
||||
// Only calling the function itself with valid arguments.
|
||||
// It generates different private keys and signatures for the message "Hello world".
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
#[pov_mode = Measured]
|
||||
seal_ecdsa_recover {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS / 10;
|
||||
|
||||
let message_hash = sp_io::hashing::blake2_256("Hello world".as_bytes());
|
||||
let key_type = sp_core::crypto::KeyTypeId(*b"code");
|
||||
@@ -2067,9 +2072,10 @@ benchmarks! {
|
||||
|
||||
// Only calling the function itself for the list of
|
||||
// generated different ECDSA keys.
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
#[pov_mode = Measured]
|
||||
seal_ecdsa_to_eth_address {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS / 10;
|
||||
let key_type = sp_core::crypto::KeyTypeId(*b"code");
|
||||
let pub_keys_bytes = (0..r)
|
||||
.flat_map(|_| {
|
||||
@@ -2105,7 +2111,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_set_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code_hashes = (0..r)
|
||||
.map(|i| {
|
||||
let new_code = WasmModule::<T>::dummy_with_bytes(i);
|
||||
@@ -2146,7 +2152,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_reentrance_count {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -2167,7 +2173,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_account_reentrance_count {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let dummy_code = WasmModule::<T>::dummy_with_bytes(0);
|
||||
let accounts = (0..r)
|
||||
.map(|i| Contract::with_index(i + 1, dummy_code.clone(), vec![]))
|
||||
@@ -2201,7 +2207,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Measured]
|
||||
seal_instantiation_nonce {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let r in 0 .. API_BENCHMARK_RUNS;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
@@ -2232,7 +2238,7 @@ benchmarks! {
|
||||
// w_i{32,64}const = w_drop = w_bench / 2
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64const {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
RandomI64Repeated(1),
|
||||
@@ -2247,7 +2253,7 @@ benchmarks! {
|
||||
// w_i{32,64}load = w_bench - 2 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64load {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
@@ -2264,7 +2270,7 @@ benchmarks! {
|
||||
// w_i{32,64}store{...} = w_bench - 2 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64store {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
@@ -2281,7 +2287,7 @@ benchmarks! {
|
||||
// w_select = w_bench - 4 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_select {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
RandomI64Repeated(1),
|
||||
@@ -2299,7 +2305,7 @@ benchmarks! {
|
||||
// w_if = w_bench - 3 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_if {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
RandomI32(0, 2),
|
||||
@@ -2320,7 +2326,7 @@ benchmarks! {
|
||||
// Block instructions are not counted.
|
||||
#[pov_mode = Ignored]
|
||||
instr_br {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
Regular(Instruction::Block(BlockType::NoResult)),
|
||||
@@ -2347,7 +2353,7 @@ benchmarks! {
|
||||
// Block instructions are not counted.
|
||||
#[pov_mode = Ignored]
|
||||
instr_br_if {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
Regular(Instruction::Block(BlockType::NoResult)),
|
||||
@@ -2375,7 +2381,7 @@ benchmarks! {
|
||||
// Block instructions are not counted.
|
||||
#[pov_mode = Ignored]
|
||||
instr_br_table {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let table = Box::new(BrTableData {
|
||||
table: Box::new([1, 1, 1]),
|
||||
default: 1,
|
||||
@@ -2442,7 +2448,7 @@ benchmarks! {
|
||||
// w_call = w_bench - 2 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_call {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
// We need to make use of the stack here in order to trigger stack height
|
||||
// instrumentation.
|
||||
@@ -2463,7 +2469,7 @@ benchmarks! {
|
||||
// w_call_indrect = w_bench - 3 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_call_indirect {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let num_elements = T::Schedule::get().limits.table_size;
|
||||
use self::code::TableSegment;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -2511,7 +2517,7 @@ benchmarks! {
|
||||
// w_local_get = w_bench - 1 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_local_get {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let max_locals = T::Schedule::get().limits.locals;
|
||||
let mut call_body = body::repeated_dyn(r, vec![
|
||||
RandomGetLocal(0, max_locals),
|
||||
@@ -2529,7 +2535,7 @@ benchmarks! {
|
||||
// w_local_set = w_bench - 1 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_local_set {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let max_locals = T::Schedule::get().limits.locals;
|
||||
let mut call_body = body::repeated_dyn(r, vec![
|
||||
RandomI64Repeated(1),
|
||||
@@ -2547,7 +2553,7 @@ benchmarks! {
|
||||
// w_local_tee = w_bench - 2 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_local_tee {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let max_locals = T::Schedule::get().limits.locals;
|
||||
let mut call_body = body::repeated_dyn(r, vec![
|
||||
RandomI64Repeated(1),
|
||||
@@ -2566,7 +2572,7 @@ benchmarks! {
|
||||
// w_global_get = w_bench - 1 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_global_get {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let max_globals = T::Schedule::get().limits.globals;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
@@ -2583,7 +2589,7 @@ benchmarks! {
|
||||
// w_global_set = w_bench - 1 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_global_set {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let max_globals = T::Schedule::get().limits.globals;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
@@ -2600,7 +2606,7 @@ benchmarks! {
|
||||
// w_memory_get = w_bench - 1 * w_param
|
||||
#[pov_mode = Ignored]
|
||||
instr_memory_current {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory::max::<T>()),
|
||||
call_body: Some(body::repeated(r, &[
|
||||
@@ -2642,7 +2648,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64clz {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::unary_instr(
|
||||
Instruction::I64Clz,
|
||||
r,
|
||||
@@ -2653,7 +2659,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64ctz {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::unary_instr(
|
||||
Instruction::I64Ctz,
|
||||
r,
|
||||
@@ -2664,7 +2670,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64popcnt {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::unary_instr(
|
||||
Instruction::I64Popcnt,
|
||||
r,
|
||||
@@ -2675,7 +2681,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64eqz {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::unary_instr(
|
||||
Instruction::I64Eqz,
|
||||
r,
|
||||
@@ -2686,7 +2692,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64extendsi32 {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
RandomI32Repeated(1),
|
||||
@@ -2701,7 +2707,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64extendui32 {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::from(ModuleDefinition {
|
||||
call_body: Some(body::repeated_dyn(r, vec![
|
||||
RandomI32Repeated(1),
|
||||
@@ -2716,7 +2722,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i32wrapi64 {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::unary_instr(
|
||||
Instruction::I32WrapI64,
|
||||
r,
|
||||
@@ -2730,7 +2736,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64eq {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Eq,
|
||||
r,
|
||||
@@ -2741,7 +2747,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64ne {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Ne,
|
||||
r,
|
||||
@@ -2752,7 +2758,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64lts {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64LtS,
|
||||
r,
|
||||
@@ -2763,7 +2769,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64ltu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64LtU,
|
||||
r,
|
||||
@@ -2774,7 +2780,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64gts {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64GtS,
|
||||
r,
|
||||
@@ -2785,7 +2791,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64gtu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64GtU,
|
||||
r,
|
||||
@@ -2796,7 +2802,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64les {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64LeS,
|
||||
r,
|
||||
@@ -2807,7 +2813,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64leu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64LeU,
|
||||
r,
|
||||
@@ -2818,7 +2824,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64ges {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64GeS,
|
||||
r,
|
||||
@@ -2829,7 +2835,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64geu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64GeU,
|
||||
r,
|
||||
@@ -2840,7 +2846,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64add {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Add,
|
||||
r,
|
||||
@@ -2851,7 +2857,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64sub {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Sub,
|
||||
r,
|
||||
@@ -2862,7 +2868,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64mul {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Mul,
|
||||
r,
|
||||
@@ -2873,7 +2879,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64divs {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64DivS,
|
||||
r,
|
||||
@@ -2884,7 +2890,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64divu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64DivU,
|
||||
r,
|
||||
@@ -2895,7 +2901,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64rems {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64RemS,
|
||||
r,
|
||||
@@ -2906,7 +2912,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64remu {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64RemU,
|
||||
r,
|
||||
@@ -2917,7 +2923,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64and {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64And,
|
||||
r,
|
||||
@@ -2928,7 +2934,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64or {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Or,
|
||||
r,
|
||||
@@ -2939,7 +2945,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64xor {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Xor,
|
||||
r,
|
||||
@@ -2950,7 +2956,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64shl {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Shl,
|
||||
r,
|
||||
@@ -2961,7 +2967,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64shrs {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64ShrS,
|
||||
r,
|
||||
@@ -2972,7 +2978,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64shru {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64ShrU,
|
||||
r,
|
||||
@@ -2983,7 +2989,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64rotl {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Rotl,
|
||||
r,
|
||||
@@ -2994,7 +3000,7 @@ benchmarks! {
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
instr_i64rotr {
|
||||
let r in 0 .. INSTR_BENCHMARK_BATCHES;
|
||||
let r in 0 .. INSTR_BENCHMARK_RUNS;
|
||||
let mut sbox = Sandbox::from(&WasmModule::<T>::binary_instr(
|
||||
Instruction::I64Rotr,
|
||||
r,
|
||||
|
||||
Generated
+963
-967
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user