Skip to content

Commit

Permalink
Chore: update runtime weight (#1927)
Browse files Browse the repository at this point in the history
* benchmark

* add pallet_session benchmark

Revert "add pallet_session benchmark"

This reverts commit 086124e.

add benchmark

* benchmark again

* benchmark 2

* benchmark 3

* use weight in runtime

* reset cargo.lock

* comment frame_pallet to decrease bench ci time

* Update weights.rs

* fix ci
  • Loading branch information
mclyk authored Mar 29, 2023
1 parent a510dd4 commit cfb3571
Show file tree
Hide file tree
Showing 58 changed files with 3,970 additions and 1,235 deletions.
26 changes: 19 additions & 7 deletions pallets/prices/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(unused_imports)]
#![allow(clippy::all)]

use frame_support::weights::Weight;
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for pallet_prices.
Expand All @@ -32,25 +32,37 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn set_price() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(22_361_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
fn reset_price() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(21_361_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
fn set_foreign_asset() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(23_361_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn set_price() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(22_361_000 as u64)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
fn reset_price() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(21_361_000 as u64)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
fn set_foreign_asset() -> Weight {
Weight::from_ref_time(10_000 as u64)
Weight::from_ref_time(23_361_000 as u64)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
}
16 changes: 8 additions & 8 deletions runtime/heiko/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ impl pallet_assets::Config for Runtime {
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -730,7 +730,7 @@ impl pallet_collator_selection::Config for Runtime {
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ValidatorRegistration = Session;
type WeightInfo = ();
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1043,7 +1043,7 @@ impl pallet_proxy::Config for Runtime {
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
Expand Down Expand Up @@ -1426,7 +1426,7 @@ impl pallet_multisig::Config for Runtime {
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1515,7 +1515,7 @@ impl pallet_democracy::Config for Runtime {
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_democracy::WeightInfo<Runtime>;
type MaxProposals = MaxProposals;
type VoteLockingPeriod = EnactmentPeriod;
type Preimages = Preimage;
Expand All @@ -1538,7 +1538,7 @@ impl pallet_collective::Config<GeneralCouncilCollective> for Runtime {
type MaxProposals = GeneralCouncilMaxProposals;
type MaxMembers = GeneralCouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}

type GeneralCouncilMembershipInstance = pallet_membership::Instance1;
Expand Down Expand Up @@ -1570,7 +1570,7 @@ impl pallet_collective::Config<TechnicalCollective> for Runtime {
type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}

type TechnicalCommitteeMembershipInstance = pallet_membership::Instance2;
Expand Down Expand Up @@ -1616,7 +1616,7 @@ impl pallet_scheduler::Config for Runtime {
type ScheduleOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
type Preimages = Preimage;
}

Expand Down
16 changes: 9 additions & 7 deletions runtime/heiko/src/weights/cumulus_pallet_xcmp_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-03-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024

Expand Down Expand Up @@ -31,14 +31,16 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
// Storage: XcmpQueue QueueConfig (r:1 w:1)
fn set_config_with_u32() -> Weight {
Weight::from_ref_time(10_012_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 11_820 nanoseconds.
Weight::from_ref_time(12_248_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: XcmpQueue QueueConfig (r:1 w:1)
fn set_config_with_weight() -> Weight {
Weight::from_ref_time(10_079_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 12_102 nanoseconds.
Weight::from_ref_time(12_272_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
54 changes: 30 additions & 24 deletions runtime/heiko/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-03-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024

Expand Down Expand Up @@ -31,45 +31,51 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
/// The range of component `b` is `[0, 3932160]`.
fn remark(b: u32, ) -> Weight {
Weight::from_ref_time(3_703_000 as u64)
// Minimum execution time: 6_842 nanoseconds.
Weight::from_ref_time(4_467_938)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64))
.saturating_add(Weight::from_ref_time(534).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64))
// Minimum execution time: 22_622 nanoseconds.
Weight::from_ref_time(19_476_218)
// Standard Error: 1
.saturating_add(Weight::from_ref_time(2_294).saturating_mul(b.into()))
}
// Storage: System Digest (r:1 w:1)
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
fn set_heap_pages() -> Weight {
Weight::from_ref_time(9_860_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
// Minimum execution time: 14_493 nanoseconds.
Weight::from_ref_time(14_783_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
/// The range of component `i` is `[0, 1000]`.
fn set_storage(i: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 1_000
.saturating_add(Weight::from_ref_time(1_021_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
// Minimum execution time: 6_691 nanoseconds.
Weight::from_ref_time(6_790_000)
// Standard Error: 2_840
.saturating_add(Weight::from_ref_time(1_092_534).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
/// The range of component `i` is `[0, 1000]`.
fn kill_storage(i: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 2_000
.saturating_add(Weight::from_ref_time(799_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
// Minimum execution time: 6_843 nanoseconds.
Weight::from_ref_time(6_880_000)
// Standard Error: 898
.saturating_add(Weight::from_ref_time(751_055).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `p` is `[1, 1000]`.
/// The range of component `p` is `[0, 1000]`.
fn kill_prefix(p: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 2_000
.saturating_add(Weight::from_ref_time(1_572_000 as u64).saturating_mul(p as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64)))
// Minimum execution time: 9_746 nanoseconds.
Weight::from_ref_time(9_918_000)
// Standard Error: 1_372
.saturating_add(Weight::from_ref_time(1_453_284).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
}
}
7 changes: 7 additions & 0 deletions runtime/heiko/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
pub mod frame_system;
pub mod pallet_assets;
pub mod pallet_collator_selection;
pub mod pallet_collective;
pub mod pallet_democracy;
pub mod pallet_multisig;
pub mod pallet_proxy;
pub mod pallet_scheduler;
pub mod pallet_amm;
pub mod pallet_asset_registry;
pub mod pallet_balances;
Expand Down
33 changes: 19 additions & 14 deletions runtime/heiko/src/weights/pallet_amm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Autogenerated weights for `pallet_amm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-03-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024

Expand Down Expand Up @@ -34,37 +34,42 @@ impl<T: frame_system::Config> pallet_amm::WeightInfo for WeightInfo<T> {
// Storage: Assets Asset (r:3 w:3)
// Storage: Assets Account (r:5 w:5)
fn add_liquidity() -> Weight {
Weight::from_ref_time(161_720_000 as u64)
.saturating_add(T::DbWeight::get().reads(10 as u64))
.saturating_add(T::DbWeight::get().writes(9 as u64))
// Minimum execution time: 172_184 nanoseconds.
Weight::from_ref_time(173_791_000)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(9))
}
// Storage: AMM Pools (r:1 w:1)
// Storage: AMM ProtocolFee (r:1 w:0)
// Storage: Assets Asset (r:3 w:3)
// Storage: Assets Account (r:5 w:5)
fn remove_liquidity() -> Weight {
Weight::from_ref_time(174_864_000 as u64)
.saturating_add(T::DbWeight::get().reads(10 as u64))
.saturating_add(T::DbWeight::get().writes(9 as u64))
// Minimum execution time: 188_419 nanoseconds.
Weight::from_ref_time(190_666_000)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(9))
}
// Storage: AMM Pools (r:1 w:1)
// Storage: Assets Asset (r:3 w:3)
// Storage: Assets Account (r:6 w:6)
// Storage: System Account (r:2 w:2)
// Storage: AMM ProtocolFee (r:1 w:0)
fn create_pool() -> Weight {
Weight::from_ref_time(217_145_000 as u64)
.saturating_add(T::DbWeight::get().reads(13 as u64))
.saturating_add(T::DbWeight::get().writes(12 as u64))
// Minimum execution time: 214_658 nanoseconds.
Weight::from_ref_time(216_739_000)
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(12))
}
// Storage: AMM ProtocolFee (r:0 w:1)
fn update_protocol_fee() -> Weight {
Weight::from_ref_time(22_954_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 24_939 nanoseconds.
Weight::from_ref_time(25_267_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: AMM ProtocolFeeReceiver (r:0 w:1)
fn update_protocol_fee_receiver() -> Weight {
Weight::from_ref_time(24_118_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
// Minimum execution time: 25_759 nanoseconds.
Weight::from_ref_time(26_507_000)
.saturating_add(T::DbWeight::get().writes(1))
}
}
37 changes: 21 additions & 16 deletions runtime/heiko/src/weights/pallet_asset_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Autogenerated weights for `pallet_asset_registry`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-03-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024

Expand Down Expand Up @@ -32,41 +32,46 @@ impl<T: frame_system::Config> pallet_asset_registry::WeightInfo for WeightInfo<T
// Storage: AssetRegistry AssetIdType (r:1 w:1)
// Storage: AssetRegistry AssetTypeId (r:0 w:1)
fn register_asset() -> Weight {
Weight::from_ref_time(30_282_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
// Minimum execution time: 33_621 nanoseconds.
Weight::from_ref_time(34_077_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: AssetRegistry AssetTypeId (r:1 w:0)
// Storage: AssetRegistry SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetRegistry AssetTypeUnitsPerSecond (r:0 w:1)
fn update_asset_units_per_second() -> Weight {
Weight::from_ref_time(37_353_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
// Minimum execution time: 40_651 nanoseconds.
Weight::from_ref_time(40_972_000)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: AssetRegistry SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetRegistry AssetIdType (r:1 w:1)
// Storage: AssetRegistry AssetTypeUnitsPerSecond (r:1 w:2)
// Storage: AssetRegistry AssetTypeId (r:0 w:2)
fn update_asset_type() -> Weight {
Weight::from_ref_time(51_300_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Minimum execution time: 52_289 nanoseconds.
Weight::from_ref_time(53_014_000)
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: AssetRegistry SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetRegistry AssetTypeUnitsPerSecond (r:0 w:1)
fn remove_fee_payment_asset() -> Weight {
Weight::from_ref_time(31_517_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
// Minimum execution time: 34_741 nanoseconds.
Weight::from_ref_time(35_328_000)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: AssetRegistry SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetRegistry AssetIdType (r:1 w:1)
// Storage: AssetRegistry AssetTypeUnitsPerSecond (r:0 w:1)
// Storage: AssetRegistry AssetTypeId (r:0 w:1)
fn deregister_asset() -> Weight {
Weight::from_ref_time(40_159_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
// Minimum execution time: 41_282 nanoseconds.
Weight::from_ref_time(41_717_000)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
}
Loading

0 comments on commit cfb3571

Please sign in to comment.