From 594e3b95516693f807f512e0deb26bad2d4f988d Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Sun, 30 Jan 2022 20:37:13 +0100 Subject: [PATCH] Add baseline benchmarks (#4777) * Don't merge this Signed-off-by: Oliver Tale-Yazdi * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/ * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/ * Add baseline benches Signed-off-by: Oliver Tale-Yazdi * Revert "Don't merge this" This reverts commit d0fcc4f9cf83492862618c3b254cb6589f1b1831. * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=frame_benchmarking::baseline --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/frame_benchmarking_baseline.rs * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=frame_benchmarking::baseline --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/frame_benchmarking_baseline.rs * Add weight modules Signed-off-by: Oliver Tale-Yazdi * Apply suggestions from code review Co-authored-by: Parity Bot Co-authored-by: Shawn Tabrizi --- runtime/kusama/src/lib.rs | 4 + .../weights/frame_benchmarking_baseline.rs | 82 +++++++++++++++++++ runtime/kusama/src/weights/pallet_balances.rs | 31 ++++--- runtime/polkadot/src/lib.rs | 4 + .../weights/frame_benchmarking_baseline.rs | 82 +++++++++++++++++++ .../polkadot/src/weights/pallet_balances.rs | 31 ++++--- 6 files changed, 210 insertions(+), 24 deletions(-) create mode 100644 runtime/kusama/src/weights/frame_benchmarking_baseline.rs create mode 100644 runtime/polkadot/src/weights/frame_benchmarking_baseline.rs diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index a43b6a4509a0..39d7d27a008b 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -2974,6 +2974,7 @@ mod benches { // Substrate [pallet_balances, Balances] [pallet_bags_list, BagsList] + [frame_benchmarking::baseline, Baseline::] [pallet_bounties, Bounties] [pallet_collective, Council] [pallet_collective, TechnicalCommittee] @@ -3340,6 +3341,7 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -3360,10 +3362,12 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} + impl frame_benchmarking::baseline::Config for Runtime {} let whitelist: Vec = vec![ // Block Number diff --git a/runtime/kusama/src/weights/frame_benchmarking_baseline.rs b/runtime/kusama/src/weights/frame_benchmarking_baseline.rs new file mode 100644 index 000000000000..433d3256cde9 --- /dev/null +++ b/runtime/kusama/src/weights/frame_benchmarking_baseline.rs @@ -0,0 +1,82 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `frame_benchmarking::baseline` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-01-28, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_benchmarking::baseline +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/kusama/src/weights/frame_benchmarking_baseline.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_benchmarking::baseline`. +pub struct WeightInfo(PhantomData); +impl frame_benchmarking::baseline::WeightInfo for WeightInfo { + fn addition(_i: u32, ) -> Weight { + (128_000 as Weight) + } + fn subtraction(_i: u32, ) -> Weight { + (128_000 as Weight) + } + fn multiplication(_i: u32, ) -> Weight { + (133_000 as Weight) + } + fn division(_i: u32, ) -> Weight { + (147_000 as Weight) + } + fn hashing(i: u32, ) -> Weight { + (19_711_716_000 as Weight) + // Standard Error: 116_000 + .saturating_add((320_000 as Weight).saturating_mul(i as Weight)) + } + fn sr25519_verification(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 14_000 + .saturating_add((47_625_000 as Weight).saturating_mul(i as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn storage_read(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 3_000 + .saturating_add((2_027_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn storage_write(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((329_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } +} diff --git a/runtime/kusama/src/weights/pallet_balances.rs b/runtime/kusama/src/weights/pallet_balances.rs index 1ec240b75fc9..71e688ff72f8 100644 --- a/runtime/kusama/src/weights/pallet_balances.rs +++ b/runtime/kusama/src/weights/pallet_balances.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2020 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -15,12 +15,12 @@ // along with Polkadot. If not, see . //! Autogenerated weights for `pallet_balances` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-07-01, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-01-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 // Executed Command: -// target/release/polkadot +// target/production/polkadot // benchmark // --chain=kusama-dev // --steps=50 @@ -33,6 +33,7 @@ // --header=./file_header.txt // --output=./runtime/kusama/src/weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -42,39 +43,45 @@ use sp_std::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - (73_559_000 as Weight) + (29_999_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 { - (54_667_000 as Weight) + (23_263_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 { - (29_203_000 as Weight) + (14_780_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 { - (35_128_000 as Weight) + (17_217_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 { - (72_833_000 as Weight) + (30_538_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 { - (67_554_000 as Weight) + (27_937_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 { - (27_766_000 as Weight) + (13_646_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 71cf2ece1ed3..af86b782614c 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1725,6 +1725,7 @@ mod benches { // Substrate [pallet_bags_list, BagsList] [pallet_balances, Balances] + [frame_benchmarking::baseline, Baseline::] [pallet_bounties, Bounties] [pallet_collective, Council] [pallet_collective, TechnicalCommittee] @@ -2091,6 +2092,7 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -2111,10 +2113,12 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} + impl frame_benchmarking::baseline::Config for Runtime {} let whitelist: Vec = vec![ // Block Number diff --git a/runtime/polkadot/src/weights/frame_benchmarking_baseline.rs b/runtime/polkadot/src/weights/frame_benchmarking_baseline.rs new file mode 100644 index 000000000000..fc00cbef73f2 --- /dev/null +++ b/runtime/polkadot/src/weights/frame_benchmarking_baseline.rs @@ -0,0 +1,82 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `frame_benchmarking::baseline` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-01-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=polkadot-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_benchmarking::baseline +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/polkadot/src/weights/frame_benchmarking_baseline.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_benchmarking::baseline`. +pub struct WeightInfo(PhantomData); +impl frame_benchmarking::baseline::WeightInfo for WeightInfo { + fn addition(_i: u32, ) -> Weight { + (112_000 as Weight) + } + fn subtraction(_i: u32, ) -> Weight { + (112_000 as Weight) + } + fn multiplication(_i: u32, ) -> Weight { + (112_000 as Weight) + } + fn division(_i: u32, ) -> Weight { + (111_000 as Weight) + } + fn hashing(i: u32, ) -> Weight { + (19_613_380_000 as Weight) + // Standard Error: 88_000 + .saturating_add((203_000 as Weight).saturating_mul(i as Weight)) + } + fn sr25519_verification(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 15_000 + .saturating_add((47_554_000 as Weight).saturating_mul(i as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn storage_read(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 3_000 + .saturating_add((1_973_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn storage_write(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((323_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } +} diff --git a/runtime/polkadot/src/weights/pallet_balances.rs b/runtime/polkadot/src/weights/pallet_balances.rs index 8aff3b4185f9..6839349f2956 100644 --- a/runtime/polkadot/src/weights/pallet_balances.rs +++ b/runtime/polkadot/src/weights/pallet_balances.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2020 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -15,12 +15,12 @@ // along with Polkadot. If not, see . //! Autogenerated weights for `pallet_balances` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-07-01, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-01-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// target/release/polkadot +// target/production/polkadot // benchmark // --chain=polkadot-dev // --steps=50 @@ -33,6 +33,7 @@ // --header=./file_header.txt // --output=./runtime/polkadot/src/weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -42,39 +43,45 @@ use sp_std::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - (68_885_000 as Weight) + (30_351_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 { - (51_441_000 as Weight) + (23_391_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 { - (27_736_000 as Weight) + (15_195_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 { - (32_999_000 as Weight) + (17_271_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 { - (67_451_000 as Weight) + (30_723_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 { - (63_359_000 as Weight) + (28_220_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 { - (27_766_000 as Weight) + (13_503_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) }