Skip to content

Commit

Permalink
Benchmark refresh (#1350)
Browse files Browse the repository at this point in the history
* Updated parachain-staking and author-mapping benchmarks

* Add #[rustfmt::skip] to weights.rs code

* Second attempt at #[rustfmt::skip]

* Format use statement

* Alpha sort imports

* Update expected gas cost in tests to reflect benchmark changes

* Update fee expectations in author mapping integration tests

* Missed one

* Update xcm-transactor and asset-manager weights
  • Loading branch information
notlesh authored Mar 18, 2022
1 parent ecad89b commit cf32828
Show file tree
Hide file tree
Showing 7 changed files with 839 additions and 384 deletions.
8 changes: 7 additions & 1 deletion benchmarking/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

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

/// Weight functions needed for {{pallet}}.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
#[rustfmt::skip]
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
Expand All @@ -49,6 +53,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{#each benchmark.comments as |comment|}}
// {{comment}}
{{/each}}
#[rustfmt::skip]
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
Expand Down Expand Up @@ -81,6 +86,7 @@ impl WeightInfo for () {
{{#each benchmark.comments as |comment|}}
// {{comment}}
{{/each}}
#[rustfmt::skip]
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
Expand Down
172 changes: 115 additions & 57 deletions pallets/asset-manager/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Autogenerated weights for pallet_asset_manager
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-02-22, STEPS: `32`, REPEAT: 64, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-03-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
Expand All @@ -28,18 +28,19 @@
// --execution=wasm
// --wasm-execution=compiled
// --pallet
// pallet_asset_manager
// *
// --extrinsic
// *
// --steps
// 32
// 50
// --repeat
// 64
// --raw
// 20
// --template=./benchmarking/frame-weight-template.hbs
// --output
// /tmp/
// --record-proof
// --json-file
// raw.json
// --output
// ./benchmarks/

#![allow(unused_parens)]
#![allow(unused_imports)]
Expand All @@ -52,76 +53,133 @@ use sp_std::marker::PhantomData;

/// Weight functions needed for pallet_asset_manager.
pub trait WeightInfo {
#[rustfmt::skip]
fn register_asset() -> Weight;
fn set_asset_units_per_second(x: u32) -> Weight;
fn change_existing_asset_type(x: u32) -> Weight;
fn remove_supported_asset(x: u32) -> Weight;
fn remove_existing_asset_type(x: u32) -> Weight;
#[rustfmt::skip]
fn set_asset_units_per_second(x: u32, ) -> Weight;
#[rustfmt::skip]
fn change_existing_asset_type(x: u32, ) -> Weight;
#[rustfmt::skip]
fn remove_supported_asset(x: u32, ) -> Weight;
#[rustfmt::skip]
fn remove_existing_asset_type(x: u32, ) -> Weight;
}

/// Weights for pallet_asset_manager using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:1)
// Storage: AssetManager AssetTypeId (r:0 w:1)
#[rustfmt::skip]
fn register_asset() -> Weight {
(52_375_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
fn set_asset_units_per_second(x: u32) -> Weight {
(31_655_000 as Weight) // Standard Error: 4_000
.saturating_add((1_258_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
(47_597_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn change_existing_asset_type(x: u32) -> Weight {
(39_476_000 as Weight) // Standard Error: 4_000
.saturating_add((1_338_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
// Storage: AssetManager AssetTypeId (r:1 w:0)
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
#[rustfmt::skip]
fn set_asset_units_per_second(x: u32, ) -> Weight {
(32_865_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_210_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn remove_supported_asset(x: u32) -> Weight {
(24_269_000 as Weight) // Standard Error: 4_000
.saturating_add((1_148_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn remove_existing_asset_type(x: u32) -> Weight {
(30_428_000 as Weight) // Standard Error: 3_000
.saturating_add((1_166_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:1 w:2)
// Storage: AssetManager AssetTypeId (r:0 w:2)
#[rustfmt::skip]
fn change_existing_asset_type(x: u32, ) -> Weight {
(40_757_000 as Weight)
// Standard Error: 4_000
.saturating_add((1_266_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
#[rustfmt::skip]
fn remove_supported_asset(x: u32, ) -> Weight {
(25_700_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_043_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
// Storage: AssetManager AssetTypeId (r:0 w:1)
#[rustfmt::skip]
fn remove_existing_asset_type(x: u32, ) -> Weight {
(32_359_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_073_000 as Weight).saturating_mul(x as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:1)
// Storage: AssetManager AssetTypeId (r:0 w:1)
#[rustfmt::skip]
fn register_asset() -> Weight {
(52_375_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
fn set_asset_units_per_second(x: u32) -> Weight {
(31_655_000 as Weight) // Standard Error: 4_000
.saturating_add((1_258_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
(47_597_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
fn change_existing_asset_type(x: u32) -> Weight {
(39_476_000 as Weight) // Standard Error: 4_000
.saturating_add((1_338_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
}
fn remove_supported_asset(x: u32) -> Weight {
(24_269_000 as Weight) // Standard Error: 4_000
.saturating_add((1_148_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
// Storage: AssetManager AssetTypeId (r:1 w:0)
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
#[rustfmt::skip]
fn set_asset_units_per_second(x: u32, ) -> Weight {
(32_865_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_210_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn remove_existing_asset_type(x: u32) -> Weight {
(30_428_000 as Weight) // Standard Error: 3_000
.saturating_add((1_166_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:1 w:2)
// Storage: AssetManager AssetTypeId (r:0 w:2)
#[rustfmt::skip]
fn change_existing_asset_type(x: u32, ) -> Weight {
(40_757_000 as Weight)
// Standard Error: 4_000
.saturating_add((1_266_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
#[rustfmt::skip]
fn remove_supported_asset(x: u32, ) -> Weight {
(25_700_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_043_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: AssetManager SupportedFeePaymentAssets (r:1 w:1)
// Storage: AssetManager AssetIdType (r:1 w:1)
// Storage: AssetManager AssetTypeUnitsPerSecond (r:0 w:1)
// Storage: AssetManager AssetTypeId (r:0 w:1)
#[rustfmt::skip]
fn remove_existing_asset_type(x: u32, ) -> Weight {
(32_359_000 as Weight)
// Standard Error: 3_000
.saturating_add((1_073_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
}
76 changes: 50 additions & 26 deletions pallets/author-mapping/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

//! Autogenerated weights for pallet_author_mapping
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-07-14, STEPS: `[32, ]`, REPEAT: 64, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-03-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/moonbeam
Expand All @@ -28,69 +28,93 @@
// --execution=wasm
// --wasm-execution=compiled
// --pallet
// pallet_author_mapping
// *
// --extrinsic
// *
// --steps
// 32
// 50
// --repeat
// 64
// --raw
// 20
// --template=./benchmarking/frame-weight-template.hbs
// --record-proof
// --json-file
// raw.json
// --output
// /tmp/
// ./benchmarks/

#![allow(unused_parens)]
#![allow(unused_imports)]

#[rustfmt::skip]
use frame_support::{
traits::Get,
weights::{constants::RocksDbWeight, Weight},
};
#[rustfmt::skip]
use sp_std::marker::PhantomData;

/// Weight functions needed for pallet_author_mapping.
pub trait WeightInfo {
#[rustfmt::skip]
fn add_association() -> Weight;
#[rustfmt::skip]
fn update_association() -> Weight;
#[rustfmt::skip]
fn clear_association() -> Weight;
}

/// Weights for pallet_author_mapping using the Substrate node and recommended hardware.
#[rustfmt::skip]
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AuthorMapping MappingWithDeposit (r:1 w:1)
// Storage: System Account (r:1 w:1)
#[rustfmt::skip]
fn add_association() -> Weight {
(44_032_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
(34_696_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: AuthorMapping MappingWithDeposit (r:2 w:2)
#[rustfmt::skip]
fn update_association() -> Weight {
(27_468_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
(26_877_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: AuthorMapping MappingWithDeposit (r:1 w:1)
// Storage: System Account (r:1 w:1)
#[rustfmt::skip]
fn clear_association() -> Weight {
(44_603_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
(36_253_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
// Storage: AuthorMapping MappingWithDeposit (r:1 w:1)
// Storage: System Account (r:1 w:1)
#[rustfmt::skip]
fn add_association() -> Weight {
(44_032_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
(34_696_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: AuthorMapping MappingWithDeposit (r:2 w:2)
#[rustfmt::skip]
fn update_association() -> Weight {
(27_468_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
(26_877_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: AuthorMapping MappingWithDeposit (r:1 w:1)
// Storage: System Account (r:1 w:1)
#[rustfmt::skip]
fn clear_association() -> Weight {
(44_603_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
(36_253_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
}
Loading

0 comments on commit cf32828

Please sign in to comment.