From 8f20d4e9d58f537843e94502990cf9549be06d1d Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Sun, 3 Jul 2022 21:40:52 +0200 Subject: [PATCH] bench real weights for pallet ud --- pallets/universal-dividend/src/lib.rs | 3 +-- pallets/universal-dividend/src/weights.rs | 12 ++++++++++++ .../src/weights/pallet_universal_dividend.rs | 19 +++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index f6ebcc8af..faf5749d2 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -374,8 +374,7 @@ pub mod pallet { #[pallet::call] impl<T: Config> Pallet<T> { /// Claim Universal Dividends - //#[pallet::weight(T::WeightInfo::claim_uds(T::MaxPastReeval::get()))] - #[pallet::weight(0)] // TODO benchmark weights + #[pallet::weight(T::WeightInfo::claim_uds(T::MaxPastReeval::get()))] pub fn claim_uds(origin: OriginFor<T>) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; Self::do_claim_uds(&who) diff --git a/pallets/universal-dividend/src/weights.rs b/pallets/universal-dividend/src/weights.rs index d82e24dab..e3b860880 100644 --- a/pallets/universal-dividend/src/weights.rs +++ b/pallets/universal-dividend/src/weights.rs @@ -23,6 +23,7 @@ pub trait WeightInfo { fn on_initialize() -> Weight; fn on_initialize_ud_created() -> Weight; fn on_initialize_ud_reevalued() -> Weight; + fn claim_uds(n: u32) -> Weight; fn transfer_ud() -> Weight; fn transfer_ud_keep_alive() -> Weight; } @@ -54,6 +55,17 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) + // Storage: Identity Identities (r:1 w:1) + // Storage: UniversalDividend CurrentUdIndex (r:1 w:0) + // Storage: UniversalDividend PastReevals (r:1 w:0) + fn claim_uds(n: u32) -> Weight { + (32_514_000 as Weight) + // Standard Error: 32_000 + .saturating_add((8_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1) diff --git a/runtime/common/src/weights/pallet_universal_dividend.rs b/runtime/common/src/weights/pallet_universal_dividend.rs index 0967f2e4f..9a1b5c980 100644 --- a/runtime/common/src/weights/pallet_universal_dividend.rs +++ b/runtime/common/src/weights/pallet_universal_dividend.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_universal_dividend` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-06-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-07-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Interpreted, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -46,7 +46,7 @@ use sp_std::marker::PhantomData; pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightInfo<T> { fn on_initialize() -> Weight { - 104_055_000 as Weight + 111_220_000 as Weight } // Storage: Membership CounterForMembership (r:1 w:0) // Storage: UniversalDividend NextReeval (r:1 w:0) @@ -54,7 +54,7 @@ impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightIn // Storage: UniversalDividend MonetaryMass (r:1 w:1) // Storage: UniversalDividend CurrentUdIndex (r:1 w:1) fn on_initialize_ud_created() -> Weight { - (1_000_000_000 as Weight) + (525_382_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -65,10 +65,21 @@ impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightIn // Storage: UniversalDividend PastReevals (r:1 w:1) // Storage: UniversalDividend CurrentUdIndex (r:1 w:1) fn on_initialize_ud_reevalued() -> Weight { - (1_500_000_000 as Weight) + (1_161_595_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) + // Storage: Identity Identities (r:1 w:1) + // Storage: UniversalDividend CurrentUdIndex (r:1 w:0) + // Storage: UniversalDividend PastReevals (r:1 w:0) + fn claim_uds(n: u32) -> Weight { + (1_221_776_000 as Weight) + // Standard Error: 958_000 + .saturating_add((7_709_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1) -- GitLab