Skip to content

Commit

Permalink
Update benchmark and weights for litmus (#339)
Browse files Browse the repository at this point in the history
* fix handling of * pallets

* fix typo

* do not benchmark pallet_scheduler

* [benchmarking bot] Auto commit generated weights files (#338)

Co-authored-by: Kailai-Wang <[email protected]>

* enable frame_system weights

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kailai-Wang <[email protected]>
  • Loading branch information
3 people authored Feb 10, 2022
1 parent 1ffbde3 commit c1a67c3
Show file tree
Hide file tree
Showing 19 changed files with 307 additions and 302 deletions.
17 changes: 8 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions runtime/litentry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,11 @@ impl pallet_scheduler::Config for Runtime {
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = (); // TODO: to be rerun - weights::pallet_scheduler::WeightInfo<Runtime>;
// TODO: we might need non-empty PreimageProvider (see below) to run the benchmark,
// otherwise I get: panicked at 'called `Result::unwrap()` on an `Err` value: ()'
type WeightInfo = ();
type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly;
type PreimageProvider = (); // TODO: maybe use pallet_preimage
type PreimageProvider = ();
type NoPreimagePostponement = ();
}

Expand Down Expand Up @@ -1022,13 +1024,13 @@ extern crate frame_benchmarking;

#[cfg(feature = "runtime-benchmarks")]
mod benches {
// TODO: pallet_scheduler
define_benchmarks!(
[frame_system, SystemBench::<Runtime>]
[pallet_balances, Balances]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[pallet_utility, Utility]
[pallet_scheduler, Scheduler]
[pallet_treasury, Treasury]
[pallet_democracy, Democracy]
[pallet_collective, Council]
Expand Down
2 changes: 1 addition & 1 deletion runtime/litentry/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod pallet_democracy;
pub mod pallet_membership;
pub mod pallet_multisig;
pub mod pallet_proxy;
// pub mod pallet_scheduler; // TODO: to be rerun
// pub mod pallet_scheduler; // TODO: see comment in code
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
22 changes: 7 additions & 15 deletions runtime/litmus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,7 @@ impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ExtrinsicFilter;
/// Weight information for the extrinsics of this pallet.
///
/// TODO:
/// use () for polkadot-v0.9.13 version as the generated frame_system weigts
/// breaks compilation: missing trait implementation `set_changes_trie_config`.
/// It looks like an upstream issue.
///
/// our runtime/src/weights/frame_system.rs is intentionally not updated.
///
/// Also note the statemine code:
/// https://github.com/paritytech/cumulus/blob/master/polkadot-parachains/statemine/src/lib.rs#L152
type SystemWeightInfo = ();
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = RuntimeBlockWeights;
/// The maximum length of a block (in bytes).
Expand Down Expand Up @@ -393,7 +383,7 @@ impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -421,9 +411,11 @@ impl pallet_scheduler::Config for Runtime {
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = (); // TODO: to be rerun - weights::pallet_scheduler::WeightInfo<Runtime>;
// TODO: we might need non-empty PreimageProvider (see below) to run the benchmark,
// otherwise I get: panicked at 'called `Result::unwrap()` on an `Err` value: ()'
type WeightInfo = ();
type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly;
type PreimageProvider = (); // TODO: maybe use pallet_preimage
type PreimageProvider = ();
type NoPreimagePostponement = ();
}

Expand Down Expand Up @@ -1022,13 +1014,13 @@ extern crate frame_benchmarking;

#[cfg(feature = "runtime-benchmarks")]
mod benches {
// TODO: pallet_scheduler
define_benchmarks!(
[frame_system, SystemBench::<Runtime>]
[pallet_balances, Balances]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[pallet_utility, Utility]
[pallet_scheduler, Scheduler]
[pallet_treasury, Treasury]
[pallet_democracy, Democracy]
[pallet_collective, Council]
Expand Down
18 changes: 9 additions & 9 deletions runtime/litmus/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-01-18, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("generate-litmus"), DB CACHE: 20
//! DATE: 2022-02-10, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("litmus-dev"), DB CACHE: 20
// Executed Command:
// ./litentry-collator
// benchmark
// --chain=generate-litmus
// --chain=litmus-dev
// --execution=wasm
// --db-cache=20
// --wasm-execution=compiled
Expand Down Expand Up @@ -58,29 +58,29 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Storage: System Digest (r:1 w:1)
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
fn set_heap_pages() -> Weight {
(5_553_000 as Weight)
(4_475_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Skipped Metadata (r:0 w:0)
fn set_storage(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 14_000
.saturating_add((1_079_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 0
.saturating_add((774_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn kill_storage(i: u32, ) -> Weight {
(2_204_000 as Weight)
(0 as Weight)
// Standard Error: 1_000
.saturating_add((667_000 as Weight).saturating_mul(i as Weight))
.saturating_add((545_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn kill_prefix(p: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 1_000
.saturating_add((1_147_000 as Weight).saturating_mul(p as Weight))
.saturating_add((1_209_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
}
4 changes: 2 additions & 2 deletions runtime/litmus/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#![allow(clippy::unnecessary_cast)]

// pub mod frame_system; // commented out, see lib.rs where `SystemWeightInfo = ()`
pub mod frame_system;
pub mod pallet_balances;
pub mod pallet_collator_selection;
pub mod pallet_collective;
Expand All @@ -26,7 +26,7 @@ pub mod pallet_extrinsic_filter;
pub mod pallet_membership;
pub mod pallet_multisig;
pub mod pallet_proxy;
// pub mod pallet_scheduler; // to be rerun
// pub mod pallet_scheduler; // TODO: see comment in code
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
20 changes: 10 additions & 10 deletions runtime/litmus/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-01-18, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("generate-litmus"), DB CACHE: 20
//! DATE: 2022-02-10, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("litmus-dev"), DB CACHE: 20
// Executed Command:
// ./litentry-collator
// benchmark
// --chain=generate-litmus
// --chain=litmus-dev
// --execution=wasm
// --db-cache=20
// --wasm-execution=compiled
Expand All @@ -47,43 +47,43 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(81_411_000 as Weight)
(66_436_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(60_220_000 as Weight)
(48_796_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
(33_668_000 as Weight)
(29_722_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
(40_566_000 as Weight)
(35_120_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
(82_634_000 as Weight)
(66_224_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
(74_036_000 as Weight)
(58_549_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
(30_514_000 as Weight)
(25_994_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
Expand Down
34 changes: 17 additions & 17 deletions runtime/litmus/src/weights/pallet_collator_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
//! Autogenerated weights for `pallet_collator_selection`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-01-18, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("generate-litmus"), DB CACHE: 20
//! DATE: 2022-02-10, STEPS: `20`, REPEAT: 50, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("litmus-dev"), DB CACHE: 20
// Executed Command:
// ./litentry-collator
// benchmark
// --chain=generate-litmus
// --chain=litmus-dev
// --execution=wasm
// --db-cache=20
// --wasm-execution=compiled
Expand All @@ -47,19 +47,19 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
// Storage: CollatorSelection Invulnerables (r:0 w:1)
fn set_invulnerables(b: u32, ) -> Weight {
(17_807_000 as Weight)
// Standard Error: 1_000
.saturating_add((58_000 as Weight).saturating_mul(b as Weight))
(15_534_000 as Weight)
// Standard Error: 0
.saturating_add((40_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: CollatorSelection DesiredCandidates (r:0 w:1)
fn set_desired_candidates() -> Weight {
(20_417_000 as Weight)
(17_168_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: CollatorSelection CandidacyBond (r:0 w:1)
fn set_candidacy_bond() -> Weight {
(16_976_000 as Weight)
(14_503_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: CollatorSelection Candidates (r:1 w:1)
Expand All @@ -69,26 +69,26 @@ impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightIn
// Storage: CollatorSelection CandidacyBond (r:1 w:0)
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
fn register_as_candidate(c: u32, ) -> Weight {
(78_609_000 as Weight)
(67_209_000 as Weight)
// Standard Error: 6_000
.saturating_add((384_000 as Weight).saturating_mul(c as Weight))
.saturating_add((356_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: CollatorSelection Candidates (r:1 w:1)
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
fn leave_intent(c: u32, ) -> Weight {
(57_674_000 as Weight)
(48_300_000 as Weight)
// Standard Error: 6_000
.saturating_add((466_000 as Weight).saturating_mul(c as Weight))
.saturating_add((461_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: System Account (r:2 w:2)
// Storage: System BlockWeight (r:1 w:1)
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
fn note_author() -> Weight {
(72_296_000 as Weight)
(58_231_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
Expand All @@ -99,10 +99,10 @@ impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightIn
// Storage: System BlockWeight (r:1 w:1)
fn new_session(r: u32, c: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 1_344_000
.saturating_add((11_063_000 as Weight).saturating_mul(r as Weight))
// Standard Error: 1_344_000
.saturating_add((44_150_000 as Weight).saturating_mul(c as Weight))
// Standard Error: 1_128_000
.saturating_add((8_978_000 as Weight).saturating_mul(r as Weight))
// Standard Error: 1_128_000
.saturating_add((37_284_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
Expand Down
Loading

0 comments on commit c1a67c3

Please sign in to comment.