Skip to content

Commit bd6303c

Browse files
authored
runtime-benchmarks (#384)
1 parent 56918d4 commit bd6303c

26 files changed

+2075
-1462
lines changed

justfile

+36-13
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,42 @@ dry-run-benchmarks mode="fast-mode" pallet="*" extrinsic="*" :
4141
--heap-pages=4096
4242
done
4343

44-
# src: https://github.com/polkadot-fellows/runtimes/blob/48ccfae6141d2924f579d81e8b1877efd208693f/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs
45-
# Benchmark a specific pallet on the "Polimec" Runtime
46-
# Use mode="production" to generate production weights.
47-
benchmark-runtime chain="polimec-paseo-local" pallet="pallet-elections-phragmen" mode="release":
48-
cargo run --features runtime-benchmarks --profile {{mode}} -p polimec-node benchmark pallet \
49-
--chain={{ chain }} \
50-
--steps=50 \
51-
--repeat=20 \
52-
--pallet={{ pallet }} \
53-
--extrinsic=* \
54-
--wasm-execution=compiled \
55-
--heap-pages=4096 \
56-
--output=runtimes/polimec/src/weights/{{ replace(pallet, "-", "_") }}.rs
44+
benchmark-runtime:
45+
#!/bin/bash
46+
steps=${4:-50}
47+
repeat=${5:-20}
48+
49+
weightsDir=./runtimes/polimec/src/weights
50+
chainSpec="polimec-paseo-local"
51+
benchmarkCommand="./target/production/polimec-node benchmark pallet"
52+
53+
54+
cargo run --features runtime-benchmarks --profile=production -p polimec-node benchmark pallet
55+
# Load all pallet names in an array.
56+
pallets=($(
57+
${benchmarkCommand} --list --chain=${chainSpec} |\
58+
tail -n+2 |\
59+
cut -d',' -f1 |\
60+
sort |\
61+
uniq
62+
))
63+
64+
echo "[+] Benchmarking ${#pallets[@]} pallets"
65+
66+
for pallet in ${pallets[@]}
67+
do
68+
output_pallet=$(echo $pallet | tr '-' '_')
69+
echo $output_pallet
70+
${benchmarkCommand} \
71+
--chain=${chainSpec} \
72+
--wasm-execution=compiled \
73+
--pallet=$pallet \
74+
--extrinsic='*' \
75+
--steps=$steps \
76+
--repeat=$repeat \
77+
--output=$weightsDir/$output_pallet.rs
78+
79+
done
5780

5881
# src: https://github.com/paritytech/polkadot-sdk/blob/bc2e5e1fe26e2c2c8ee766ff9fe7be7e212a0c62/substrate/frame/nfts/src/weights.rs
5982
# Run the Runtime benchmarks for a specific pallet

runtimes/polimec/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1488,8 +1488,8 @@ impl_runtime_apis! {
14881488

14891489
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
14901490
use xcm::latest::prelude::*;
1491-
/// TODO: Update these benchmarks once we enable PLMC Teleportation and upgrade pallet_xcm. New version has
1492-
/// a better and quite different trait
1491+
// TODO: Update these benchmarks once we enable PLMC Teleportation and upgrade pallet_xcm. New version has
1492+
// a better and quite different trait
14931493
parameter_types! {
14941494
pub ExistentialDepositAsset: Option<Asset> = Some((
14951495
xcm_config::HereLocation::get(),

runtimes/polimec/src/weights/cumulus_pallet_parachain_system.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11

22
//! Autogenerated weights for `cumulus_pallet_parachain_system`
33
//!
4-
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
5-
//! DATE: 2024-04-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 39.0.0
5+
//! DATE: 2024-08-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
66
//! WORST CASE MAP SIZE: `1000000`
77
//! HOSTNAME: `ip-172-31-23-147`, CPU: `AMD EPYC 9R14`
8-
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-local")`, DB CACHE: 1024
8+
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-paseo-local")`, DB CACHE: 1024
99
1010
// Executed Command:
1111
// ./target/production/polimec-node
1212
// benchmark
1313
// pallet
14-
// --chain=polimec-local
15-
// --steps=50
16-
// --repeat=20
14+
// --chain=polimec-paseo-local
15+
// --wasm-execution=compiled
1716
// --pallet=cumulus_pallet_parachain_system
1817
// --extrinsic=*
19-
// --wasm-execution=compiled
20-
// --heap-pages=4096
21-
// --output=runtimes/polimec/src/weights/cumulus_pallet_parachain_system.rs
18+
// --steps=50
19+
// --repeat=20
20+
// --output=./runtimes/polimec/src/weights/cumulus_pallet_parachain_system.rs
2221

2322
#![cfg_attr(rustfmt, rustfmt_skip)]
2423
#![allow(unused_parens)]
@@ -46,11 +45,11 @@ impl<T: frame_system::Config> cumulus_pallet_parachain_system::WeightInfo for We
4645
// Proof Size summary in bytes:
4746
// Measured: `12`
4847
// Estimated: `3517`
49-
// Minimum execution time: 2_060_000 picoseconds.
50-
Weight::from_parts(2_150_000, 0)
48+
// Minimum execution time: 1_990_000 picoseconds.
49+
Weight::from_parts(2_090_000, 0)
5150
.saturating_add(Weight::from_parts(0, 3517))
52-
// Standard Error: 19_164
53-
.saturating_add(Weight::from_parts(169_295_388, 0).saturating_mul(n.into()))
51+
// Standard Error: 21_455
52+
.saturating_add(Weight::from_parts(187_017_461, 0).saturating_mul(n.into()))
5453
.saturating_add(T::DbWeight::get().reads(3))
5554
.saturating_add(T::DbWeight::get().writes(4))
5655
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))

runtimes/polimec/src/weights/cumulus_pallet_xcmp_queue.rs

+37-38
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11

22
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
33
//!
4-
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
5-
//! DATE: 2024-04-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 39.0.0
5+
//! DATE: 2024-08-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
66
//! WORST CASE MAP SIZE: `1000000`
77
//! HOSTNAME: `ip-172-31-23-147`, CPU: `AMD EPYC 9R14`
8-
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-local")`, DB CACHE: 1024
8+
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-paseo-local")`, DB CACHE: 1024
99
1010
// Executed Command:
1111
// ./target/production/polimec-node
1212
// benchmark
1313
// pallet
14-
// --chain=polimec-local
15-
// --steps=50
16-
// --repeat=20
14+
// --chain=polimec-paseo-local
15+
// --wasm-execution=compiled
1716
// --pallet=cumulus_pallet_xcmp_queue
1817
// --extrinsic=*
19-
// --wasm-execution=compiled
20-
// --heap-pages=4096
21-
// --output=runtimes/polimec/src/weights/cumulus_pallet_xcmp_queue.rs
18+
// --steps=50
19+
// --repeat=20
20+
// --output=./runtimes/polimec/src/weights/cumulus_pallet_xcmp_queue.rs
2221

2322
#![cfg_attr(rustfmt, rustfmt_skip)]
2423
#![allow(unused_parens)]
@@ -32,67 +31,67 @@ use core::marker::PhantomData;
3231
pub struct WeightInfo<T>(PhantomData<T>);
3332
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
3433
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:1)
35-
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
34+
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`)
3635
fn set_config_with_u32() -> Weight {
3736
// Proof Size summary in bytes:
3837
// Measured: `109`
39-
// Estimated: `1594`
40-
// Minimum execution time: 4_040_000 picoseconds.
41-
Weight::from_parts(4_200_000, 0)
42-
.saturating_add(Weight::from_parts(0, 1594))
38+
// Estimated: `1497`
39+
// Minimum execution time: 3_850_000 picoseconds.
40+
Weight::from_parts(4_090_000, 0)
41+
.saturating_add(Weight::from_parts(0, 1497))
4342
.saturating_add(T::DbWeight::get().reads(1))
4443
.saturating_add(T::DbWeight::get().writes(1))
4544
}
4645
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:0)
47-
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
46+
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`)
4847
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
4948
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
5049
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
5150
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
5251
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
53-
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
52+
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
5453
/// Storage: `MessageQueue::Pages` (r:0 w:1)
5554
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
5655
fn enqueue_xcmp_message() -> Weight {
5756
// Proof Size summary in bytes:
5857
// Measured: `115`
59-
// Estimated: `3517`
60-
// Minimum execution time: 10_010_000 picoseconds.
61-
Weight::from_parts(10_320_000, 0)
62-
.saturating_add(Weight::from_parts(0, 3517))
58+
// Estimated: `5487`
59+
// Minimum execution time: 9_630_000 picoseconds.
60+
Weight::from_parts(10_170_000, 0)
61+
.saturating_add(Weight::from_parts(0, 5487))
6362
.saturating_add(T::DbWeight::get().reads(4))
6463
.saturating_add(T::DbWeight::get().writes(3))
6564
}
6665
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
67-
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
66+
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`)
6867
fn suspend_channel() -> Weight {
6968
// Proof Size summary in bytes:
7069
// Measured: `109`
71-
// Estimated: `1594`
72-
// Minimum execution time: 2_800_000 picoseconds.
73-
Weight::from_parts(2_900_000, 0)
74-
.saturating_add(Weight::from_parts(0, 1594))
70+
// Estimated: `2767`
71+
// Minimum execution time: 2_780_000 picoseconds.
72+
Weight::from_parts(3_020_000, 0)
73+
.saturating_add(Weight::from_parts(0, 2767))
7574
.saturating_add(T::DbWeight::get().reads(1))
7675
.saturating_add(T::DbWeight::get().writes(1))
7776
}
7877
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
79-
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
78+
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`)
8079
fn resume_channel() -> Weight {
8180
// Proof Size summary in bytes:
8281
// Measured: `144`
83-
// Estimated: `1629`
84-
// Minimum execution time: 3_750_000 picoseconds.
85-
Weight::from_parts(3_980_000, 0)
86-
.saturating_add(Weight::from_parts(0, 1629))
82+
// Estimated: `2767`
83+
// Minimum execution time: 3_560_000 picoseconds.
84+
Weight::from_parts(3_850_000, 0)
85+
.saturating_add(Weight::from_parts(0, 2767))
8786
.saturating_add(T::DbWeight::get().reads(1))
8887
.saturating_add(T::DbWeight::get().writes(1))
8988
}
9089
fn take_first_concatenated_xcm() -> Weight {
9190
// Proof Size summary in bytes:
9291
// Measured: `0`
9392
// Estimated: `0`
94-
// Minimum execution time: 60_200_000 picoseconds.
95-
Weight::from_parts(60_431_000, 0)
93+
// Minimum execution time: 5_560_000 picoseconds.
94+
Weight::from_parts(5_690_000, 0)
9695
.saturating_add(Weight::from_parts(0, 0))
9796
}
9897
/// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1)
@@ -104,17 +103,17 @@ impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightIn
104103
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
105104
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
106105
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:0)
107-
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
106+
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`)
108107
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
109-
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
108+
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
110109
/// Storage: `MessageQueue::Pages` (r:0 w:1)
111110
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
112111
fn on_idle_good_msg() -> Weight {
113112
// Proof Size summary in bytes:
114113
// Measured: `65744`
115114
// Estimated: `69209`
116-
// Minimum execution time: 96_810_000 picoseconds.
117-
Weight::from_parts(102_230_000, 0)
115+
// Minimum execution time: 100_270_000 picoseconds.
116+
Weight::from_parts(103_031_000, 0)
118117
.saturating_add(Weight::from_parts(0, 69209))
119118
.saturating_add(T::DbWeight::get().reads(6))
120119
.saturating_add(T::DbWeight::get().writes(5))
@@ -127,8 +126,8 @@ impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightIn
127126
// Proof Size summary in bytes:
128127
// Measured: `65743`
129128
// Estimated: `69208`
130-
// Minimum execution time: 43_200_000 picoseconds.
131-
Weight::from_parts(44_860_000, 0)
129+
// Minimum execution time: 38_800_000 picoseconds.
130+
Weight::from_parts(41_200_000, 0)
132131
.saturating_add(Weight::from_parts(0, 69208))
133132
.saturating_add(T::DbWeight::get().reads(2))
134133
.saturating_add(T::DbWeight::get().writes(2))

0 commit comments

Comments
 (0)