mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Update benchmarking macros (#3934)
Current benchmarking macro returns a closure with the captured
benchmarked code.
This can cause issues when the benchmarked code has complex lifetime
requirements.
This PR updates the existing macro by injecting the recording parameter
and invoking the start / stop method around the benchmarked block
instead of returning a closure
One other added benefit is that you can write this kind of code now as
well:
```rust
let v;
#[block]
{ v = func.call(); }
dbg!(v); // or assert something on v
```
[Weights compare
link](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=pg/fix-weights&new=pg/bench_update&path_pattern=substrate/frame/**/src/weights.rs,polkadot/runtime/*/src/weights/**/*.rs,polkadot/bridges/modules/*/src/weights.rs,cumulus/**/weights/*.rs,cumulus/**/weights/xcm/*.rs,cumulus/**/src/weights.rs)
---------
Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
This commit is contained in:
+78
-74
@@ -17,24 +17,28 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_asset_conversion`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-10-30, STEPS: `5`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `cob`, CPU: `<UNKNOWN>`
|
||||
//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024`
|
||||
|
||||
// Executed Command:
|
||||
// ./target/debug/substrate-node
|
||||
// ./target/production/substrate-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=dev
|
||||
// --steps=5
|
||||
// --repeat=2
|
||||
// --pallet=pallet-asset-conversion
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet_asset_conversion
|
||||
// --no-storage-info
|
||||
// --no-median-slopes
|
||||
// --no-min-squares
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --output=./substrate/frame/asset-conversion/src/weights.rs
|
||||
// --header=./substrate/HEADER-APACHE2
|
||||
// --template=./substrate/.maintain/frame-weight-template.hbs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
@@ -59,11 +63,9 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:1)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:2 w:2)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:2 w:2)
|
||||
/// Storage: `Assets::Asset` (r:2 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
|
||||
/// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
@@ -73,11 +75,32 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn create_pool() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1081`
|
||||
// Measured: `910`
|
||||
// Estimated: `6360`
|
||||
// Minimum execution time: 1_576_000_000 picoseconds.
|
||||
Weight::from_parts(1_668_000_000, 6360)
|
||||
.saturating_add(T::DbWeight::get().reads(10_u64))
|
||||
// Minimum execution time: 86_709_000 picoseconds.
|
||||
Weight::from_parts(88_841_000, 6360)
|
||||
.saturating_add(T::DbWeight::get().reads(7_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:0)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:2 w:2)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:4 w:4)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Asset` (r:1 w:1)
|
||||
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Account` (r:2 w:2)
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn add_liquidity() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1507`
|
||||
// Estimated: `11426`
|
||||
// Minimum execution time: 148_672_000 picoseconds.
|
||||
Weight::from_parts(151_824_000, 11426)
|
||||
.saturating_add(T::DbWeight::get().reads(11_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(10_u64))
|
||||
}
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:0)
|
||||
@@ -88,33 +111,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Asset` (r:1 w:1)
|
||||
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Account` (r:2 w:2)
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn add_liquidity() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1761`
|
||||
// Estimated: `11426`
|
||||
// Minimum execution time: 1_636_000_000 picoseconds.
|
||||
Weight::from_parts(1_894_000_000, 11426)
|
||||
.saturating_add(T::DbWeight::get().reads(10_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(9_u64))
|
||||
}
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:0)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:2 w:2)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:4 w:4)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Asset` (r:1 w:1)
|
||||
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Account` (r:1 w:1)
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn remove_liquidity() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1750`
|
||||
// Measured: `1650`
|
||||
// Estimated: `11426`
|
||||
// Minimum execution time: 1_507_000_000 picoseconds.
|
||||
Weight::from_parts(1_524_000_000, 11426)
|
||||
// Minimum execution time: 130_743_000 picoseconds.
|
||||
Weight::from_parts(132_793_000, 11426)
|
||||
.saturating_add(T::DbWeight::get().reads(9_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(8_u64))
|
||||
}
|
||||
@@ -125,12 +129,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `n` is `[2, 4]`.
|
||||
fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0 + n * (522 ±0)`
|
||||
// Measured: `89 + n * (419 ±0)`
|
||||
// Estimated: `990 + n * (5218 ±0)`
|
||||
// Minimum execution time: 937_000_000 picoseconds.
|
||||
Weight::from_parts(941_000_000, 990)
|
||||
// Standard Error: 40_863_477
|
||||
.saturating_add(Weight::from_parts(205_862_068, 0).saturating_mul(n.into()))
|
||||
// Minimum execution time: 81_173_000 picoseconds.
|
||||
Weight::from_parts(82_574_000, 990)
|
||||
// Standard Error: 335_929
|
||||
.saturating_add(Weight::from_parts(11_607_291, 0).saturating_mul(n.into()))
|
||||
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
|
||||
@@ -142,12 +146,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `n` is `[2, 4]`.
|
||||
fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0 + n * (522 ±0)`
|
||||
// Measured: `89 + n * (419 ±0)`
|
||||
// Estimated: `990 + n * (5218 ±0)`
|
||||
// Minimum execution time: 935_000_000 picoseconds.
|
||||
Weight::from_parts(947_000_000, 990)
|
||||
// Standard Error: 46_904_620
|
||||
.saturating_add(Weight::from_parts(218_275_862, 0).saturating_mul(n.into()))
|
||||
// Minimum execution time: 80_562_000 picoseconds.
|
||||
Weight::from_parts(82_501_000, 990)
|
||||
// Standard Error: 329_460
|
||||
.saturating_add(Weight::from_parts(11_295_339, 0).saturating_mul(n.into()))
|
||||
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
|
||||
@@ -158,11 +162,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
impl WeightInfo for () {
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:1)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:2 w:2)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:2 w:2)
|
||||
/// Storage: `Assets::Asset` (r:2 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
|
||||
/// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
@@ -172,12 +174,12 @@ impl WeightInfo for () {
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn create_pool() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1081`
|
||||
// Measured: `910`
|
||||
// Estimated: `6360`
|
||||
// Minimum execution time: 1_576_000_000 picoseconds.
|
||||
Weight::from_parts(1_668_000_000, 6360)
|
||||
.saturating_add(RocksDbWeight::get().reads(10_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(10_u64))
|
||||
// Minimum execution time: 86_709_000 picoseconds.
|
||||
Weight::from_parts(88_841_000, 6360)
|
||||
.saturating_add(RocksDbWeight::get().reads(7_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:0)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
@@ -185,18 +187,20 @@ impl WeightInfo for () {
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:4 w:4)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Asset` (r:1 w:1)
|
||||
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `PoolAssets::Account` (r:2 w:2)
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn add_liquidity() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1761`
|
||||
// Measured: `1507`
|
||||
// Estimated: `11426`
|
||||
// Minimum execution time: 1_636_000_000 picoseconds.
|
||||
Weight::from_parts(1_894_000_000, 11426)
|
||||
.saturating_add(RocksDbWeight::get().reads(10_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(9_u64))
|
||||
// Minimum execution time: 148_672_000 picoseconds.
|
||||
Weight::from_parts(151_824_000, 11426)
|
||||
.saturating_add(RocksDbWeight::get().reads(11_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(10_u64))
|
||||
}
|
||||
/// Storage: `AssetConversion::Pools` (r:1 w:0)
|
||||
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
|
||||
@@ -210,10 +214,10 @@ impl WeightInfo for () {
|
||||
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn remove_liquidity() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `1750`
|
||||
// Measured: `1650`
|
||||
// Estimated: `11426`
|
||||
// Minimum execution time: 1_507_000_000 picoseconds.
|
||||
Weight::from_parts(1_524_000_000, 11426)
|
||||
// Minimum execution time: 130_743_000 picoseconds.
|
||||
Weight::from_parts(132_793_000, 11426)
|
||||
.saturating_add(RocksDbWeight::get().reads(9_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(8_u64))
|
||||
}
|
||||
@@ -224,12 +228,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `n` is `[2, 4]`.
|
||||
fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0 + n * (522 ±0)`
|
||||
// Measured: `89 + n * (419 ±0)`
|
||||
// Estimated: `990 + n * (5218 ±0)`
|
||||
// Minimum execution time: 937_000_000 picoseconds.
|
||||
Weight::from_parts(941_000_000, 990)
|
||||
// Standard Error: 40_863_477
|
||||
.saturating_add(Weight::from_parts(205_862_068, 0).saturating_mul(n.into()))
|
||||
// Minimum execution time: 81_173_000 picoseconds.
|
||||
Weight::from_parts(82_574_000, 990)
|
||||
// Standard Error: 335_929
|
||||
.saturating_add(Weight::from_parts(11_607_291, 0).saturating_mul(n.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
|
||||
@@ -241,12 +245,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `n` is `[2, 4]`.
|
||||
fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0 + n * (522 ±0)`
|
||||
// Measured: `89 + n * (419 ±0)`
|
||||
// Estimated: `990 + n * (5218 ±0)`
|
||||
// Minimum execution time: 935_000_000 picoseconds.
|
||||
Weight::from_parts(947_000_000, 990)
|
||||
// Standard Error: 46_904_620
|
||||
.saturating_add(Weight::from_parts(218_275_862, 0).saturating_mul(n.into()))
|
||||
// Minimum execution time: 80_562_000 picoseconds.
|
||||
Weight::from_parts(82_501_000, 990)
|
||||
// Standard Error: 329_460
|
||||
.saturating_add(Weight::from_parts(11_295_339, 0).saturating_mul(n.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
|
||||
.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
|
||||
|
||||
Reference in New Issue
Block a user