Skip to content

Commit

Permalink
feat: update benchmark and weighhts one more time
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoks authored and Rqnsom committed May 22, 2024
1 parent 38ecadb commit 6a12b2c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 60 deletions.
44 changes: 9 additions & 35 deletions pallet/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod benchmarks {
use super::*;

#[benchmark]
fn execute(n: Linear<0, 9>) {
fn execute(n: Linear<0, 7>) {
let bob_32 = utils::account::<T>(utils::BOB_ADDR);
let alice_32 = utils::account::<T>(utils::ALICE_ADDR);
let dave_32 = utils::account::<T>(utils::DAVE_ADDR);
Expand All @@ -37,9 +37,7 @@ mod benchmarks {
car_wash_buy_coin().to_vec(),
car_wash_wash_car().to_vec(),
gas_costs_short_cheap_script().to_vec(),
gas_costs_short_expensive_script().to_vec(),
gas_costs_long_cheap_script().to_vec(),
gas_costs_long_expensive_script().to_vec(),
multiple_signers_init_module().to_vec(),
multiple_signers_rent_apartment().to_vec(),
];
Expand All @@ -51,17 +49,15 @@ mod benchmarks {
alice_32.clone(),
alice_32.clone(), // gas-costs
alice_32.clone(),
alice_32.clone(),
alice_32.clone(),
bob_32.clone(), // multiple-signers
eve_32,
];
// Needed gas amounts for each script, estimated by smove.
let gas = [343, 197, 795, 425, 1, 6166264, 8, 6058953, 308, 1377];
let gas = [343, 197, 795, 425, 1, 8, 308, 1377];
// Balance limit to be used.
let regular = [LIMIT; 4];
let max = [u128::MAX; 4];
let limit = [regular, max, regular].concat();
let regular = [LIMIT; 2];
let max = [u128::MAX; 2];
let limit = [regular, regular, max, regular].concat();

// Now we have to prepare each script execution with a proper setup.
// Publish both modules always.
Expand All @@ -79,7 +75,7 @@ mod benchmarks {
.unwrap();

// Now prepare individual situations for proper script sequences.
if n > 0 && n < 8 {
if n > 0 && n < 6 {
Pallet::<T>::execute(
RawOrigin::Signed(bob_32.clone()).into(),
car_wash_initial_coin_miniting().to_vec(),
Expand Down Expand Up @@ -114,7 +110,7 @@ mod benchmarks {
.unwrap();
}
}
if n > 8 {
if n > 6 {
Pallet::<T>::execute(
RawOrigin::Signed(bob_32.clone()).into(),
multiple_signers_init_module().to_vec(),
Expand Down Expand Up @@ -155,9 +151,8 @@ mod benchmarks {
multiple_signers_module().to_vec(),
car_wash_example_module().to_vec(),
base58_smove_build_module().to_vec(),
basic_coin_module().to_vec(),
];
let gas = [661, 732, 100, 576];
let gas = [661, 732, 100];

#[extrinsic_call]
publish_module(
Expand All @@ -175,9 +170,8 @@ mod benchmarks {
multiple_signers_module_as_bundle().to_vec(),
car_wash_example_module_as_bundle().to_vec(),
base58_smove_build_module_as_bundle().to_vec(),
basic_coin_module_as_bundle().to_vec(),
];
let gas = [664, 735, 102, 579];
let gas = [664, 735, 102];

#[extrinsic_call]
publish_module_bundle(
Expand Down Expand Up @@ -237,18 +231,6 @@ mod benchmark_only {
)
}

// basic_coin example
pub fn basic_coin_module() -> &'static [u8] {
core::include_bytes!(
"assets/move-projects/basic_coin/build/basic_coin/bytecode_modules/BasicCoin.mv"
)
}
pub fn basic_coin_module_as_bundle() -> &'static [u8] {
core::include_bytes!(
"assets/move-projects/basic_coin/build/basic_coin/bundles/basic_coin.mvb"
)
}

// Car Wash Example
pub fn car_wash_example_module() -> &'static [u8] {
core::include_bytes!(
Expand Down Expand Up @@ -305,15 +287,7 @@ mod benchmark_only {
core::include_bytes!("assets/move-projects/gas-costs/build/gas-costs/script_transactions/short_cheap_script.mvt")
}

pub fn gas_costs_short_expensive_script() -> &'static [u8] {
core::include_bytes!("assets/move-projects/gas-costs/build/gas-costs/script_transactions/short_expensive_script.mvt")
}

pub fn gas_costs_long_cheap_script() -> &'static [u8] {
core::include_bytes!("assets/move-projects/gas-costs/build/gas-costs/script_transactions/long_cheap_script.mvt")
}

pub fn gas_costs_long_expensive_script() -> &'static [u8] {
core::include_bytes!("assets/move-projects/gas-costs/build/gas-costs/script_transactions/long_expensive_script.mvt")
}
}
50 changes: 25 additions & 25 deletions pallet/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! Autogenerated weights for `pallet_move`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-05-21, STEPS: `100`, REPEAT: `25`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-05-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `EQML220902-02`, CPU: `<UNKNOWN>`
//! HOSTNAME: `michaeleberhardts-MacBook-Pro.local`, CPU: `<UNKNOWN>`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
// Executed Command:
Expand All @@ -19,9 +19,9 @@
// --extrinsic
// *
// --steps
// 100
// 50
// --repeat
// 25
// 20
// --output
// weights.rs

Expand All @@ -46,32 +46,32 @@ impl<T: frame_system::Config> crate::weight_info::WeightInfo for SubstrateWeight
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `MoveModule::VMStorage` (r:2 w:1)
/// Proof: `MoveModule::VMStorage` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[0, 9]`.
/// The range of component `n` is `[0, 7]`.
fn execute(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `9476`
// Estimated: `17303 + n * (1491 ±8)`
// Measured: `9479`
// Estimated: `17285 + n * (1902 ±16)`
// Minimum execution time: 33_000_000 picoseconds.
Weight::from_parts(35_000_000, 0)
.saturating_add(Weight::from_parts(0, 17303))
// Standard Error: 192_486_421
.saturating_add(Weight::from_parts(5_799_434_900, 0).saturating_mul(n.into()))
Weight::from_parts(33_000_000, 0)
.saturating_add(Weight::from_parts(0, 17285))
// Standard Error: 70_255_180
.saturating_add(Weight::from_parts(989_536_443, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1491).saturating_mul(n.into()))
.saturating_add(Weight::from_parts(0, 1902).saturating_mul(n.into()))
}
/// Storage: `MoveModule::VMStorage` (r:1 w:1)
/// Proof: `MoveModule::VMStorage` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[0, 2]`.
fn publish_module(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `7796`
// Estimated: `13927`
// Minimum execution time: 43_000_000 picoseconds.
Weight::from_parts(310_580_327, 0)
.saturating_add(Weight::from_parts(0, 13927))
// Standard Error: 1_786_407
.saturating_add(Weight::from_parts(19_643_866, 0).saturating_mul(n.into()))
// Estimated: `14073`
// Minimum execution time: 44_000_000 picoseconds.
Weight::from_parts(316_123_480, 0)
.saturating_add(Weight::from_parts(0, 14073))
// Standard Error: 3_617_919
.saturating_add(Weight::from_parts(3_931_767, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
Expand All @@ -81,12 +81,12 @@ impl<T: frame_system::Config> crate::weight_info::WeightInfo for SubstrateWeight
fn publish_module_bundle(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `7796`
// Estimated: `13927`
// Minimum execution time: 46_000_000 picoseconds.
Weight::from_parts(312_612_550, 0)
.saturating_add(Weight::from_parts(0, 13927))
// Standard Error: 2_014_955
.saturating_add(Weight::from_parts(38_749_744, 0).saturating_mul(n.into()))
// Estimated: `14073`
// Minimum execution time: 44_000_000 picoseconds.
Weight::from_parts(316_786_740, 0)
.saturating_add(Weight::from_parts(0, 14073))
// Standard Error: 3_624_642
.saturating_add(Weight::from_parts(3_790_883, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
Expand All @@ -97,7 +97,7 @@ impl<T: frame_system::Config> crate::weight_info::WeightInfo for SubstrateWeight
// Measured: `7796`
// Estimated: `11261`
// Minimum execution time: 204_000_000 picoseconds.
Weight::from_parts(218_000_000, 0)
Weight::from_parts(205_000_000, 0)
.saturating_add(Weight::from_parts(0, 11261))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand Down

0 comments on commit 6a12b2c

Please sign in to comment.