Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

update weights (0.9.31) #6173

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion runtime/kusama/constants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ frame-support = { git = "https://github.com/paritytech/substrate", default-featu
primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false }
runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }

[features]
default = ["std"]
std = [
"sp-runtime/std"
"sp-runtime/std",
"sp-core/std",
"sp-weights/std",
"frame-support/std",
"primitives/std",
]
59 changes: 28 additions & 31 deletions runtime/kusama/constants/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// This file is part of Substrate.
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 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 <http://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-08-19 (Y/M/D)
//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2022-10-21 (Y/M/D)
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: `runtime/kusama/constants/src/weights/`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`

// Executed Command:
// ./target/production/polkadot
Expand All @@ -34,32 +32,31 @@
// --weight-path=runtime/kusama/constants/src/weights/
// --warmup=10
// --repeat=100
// --header=./file_header.txt

use frame_support::{
parameter_types,
weights::{constants::WEIGHT_PER_NANOS, Weight},
};
use sp_core::parameter_types;
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};

parameter_types! {
/// Time to execute an empty block.
/// Calculated by multiplying the *Average* with `1` and adding `0`.
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 6_094_385, 6_351_993
/// Average: 6_192_341
/// Median: 6_193_838
/// Std-Dev: 63893.84
/// Min, Max: 6_346_664, 6_580_384
/// Average: 6_413_840
/// Median: 6_403_880
/// Std-Dev: 42837.51
///
/// Percentiles nanoseconds:
/// 99th: 6_332_047
/// 95th: 6_308_225
/// 75th: 6_236_204
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(6_192_341);
/// 99th: 6_536_632
/// 95th: 6_492_330
/// 75th: 6_436_794
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(6_413_840);
}

#[cfg(test)]
mod test_weights {
use frame_support::weights::constants;
use sp_weights::constants;

/// Checks that the weight exists and is sane.
// NOTE: If this test fails but you are sure that the generated values are fine,
Expand Down
62 changes: 30 additions & 32 deletions runtime/kusama/constants/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
// This file is part of Substrate.
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 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 <http://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-04-20 (Y/M/D)
//! DATE: 2022-10-21 (Y/M/D)
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: `runtime/kusama/constants/src/weights/`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`

// Executed Command:
// ./target/production/polkadot
Expand All @@ -33,32 +32,31 @@
// --weight-path=runtime/kusama/constants/src/weights/
// --warmup=10
// --repeat=100
// --header=./file_header.txt

use frame_support::{
parameter_types,
weights::{constants::WEIGHT_PER_NANOS, Weight},
};
use sp_core::parameter_types;
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};

parameter_types! {
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
/// Calculated by multiplying the *Average* with `1` and adding `0`.
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats [NS]:
/// Min, Max: 85_946, 88_408
/// Average: 86_309
/// Median: 86_213
/// Std-Dev: 345.03
/// Stats nanoseconds:
/// Min, Max: 95_170, 96_709
/// Average: 95_599
/// Median: 95_544
/// Std-Dev: 293.98
///
/// Percentiles [NS]:
/// 99th: 87_527
/// 95th: 86_901
/// 75th: 86_308
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(86_309);
/// Percentiles nanoseconds:
/// 99th: 96_541
/// 95th: 96_307
/// 75th: 95_644
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(95_599);
}

#[cfg(test)]
mod test_weights {
use frame_support::weights::constants;
use sp_weights::constants;

/// Checks that the weight exists and is sane.
// NOTE: If this test fails but you are sure that the generated values are fine,
Expand Down
40 changes: 20 additions & 20 deletions runtime/kusama/src/weights/frame_benchmarking_baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//! Autogenerated weights for `frame_benchmarking::baseline`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024

// Executed Command:
Expand All @@ -38,54 +38,54 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

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

/// Weight functions for `frame_benchmarking::baseline`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for WeightInfo<T> {
/// The range of component `i` is `[0, 1000000]`.
fn addition(_i: u32, ) -> Weight {
Weight::from_ref_time(114_000 as u64)
Weight::from_ref_time(103_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn subtraction(_i: u32, ) -> Weight {
Weight::from_ref_time(125_000 as u64)
Weight::from_ref_time(101_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn multiplication(_i: u32, ) -> Weight {
Weight::from_ref_time(116_000 as u64)
Weight::from_ref_time(97_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn division(_i: u32, ) -> Weight {
Weight::from_ref_time(115_000 as u64)
Weight::from_ref_time(105_000 as u64)
}
/// The range of component `i` is `[0, 100]`.
fn hashing(i: u32, ) -> Weight {
Weight::from_ref_time(19_441_790_000 as u64)
// Standard Error: 126_000
.saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(i as u64))
Weight::from_ref_time(19_180_361_000 as u64)
// Standard Error: 90_955
.saturating_add(Weight::from_ref_time(2_113_890 as u64).saturating_mul(i as u64))
}
/// The range of component `i` is `[1, 100]`.
/// The range of component `i` is `[0, 100]`.
fn sr25519_verification(i: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 35_000
.saturating_add(Weight::from_ref_time(47_909_000 as u64).saturating_mul(i as u64))
Weight::from_ref_time(141_000 as u64)
// Standard Error: 8_654
.saturating_add(Weight::from_ref_time(47_428_845 as u64).saturating_mul(i as u64))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[0, 1000]`.
fn storage_read(i: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 7_000
.saturating_add(Weight::from_ref_time(1_998_000 as u64).saturating_mul(i as u64))
Weight::from_ref_time(113_000 as u64)
// Standard Error: 3_822
.saturating_add(Weight::from_ref_time(1_908_438 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(i as u64)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[0, 1000]`.
fn storage_write(i: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(338_000 as u64).saturating_mul(i as u64))
Weight::from_ref_time(126_000 as u64)
// Standard Error: 805
.saturating_add(Weight::from_ref_time(320_614 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
}
}
26 changes: 13 additions & 13 deletions runtime/kusama/src/weights/frame_election_provider_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//! Autogenerated weights for `frame_election_provider_support`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-09-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024

// Executed Command:
Expand All @@ -38,7 +38,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

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

/// Weight functions for `frame_election_provider_support`.
Expand All @@ -48,20 +48,20 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
/// The range of component `t` is `[500, 1000]`.
/// The range of component `d` is `[5, 16]`.
fn phragmen(v: u32, _t: u32, d: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 56_000
.saturating_add(Weight::from_ref_time(13_944_000 as u64).saturating_mul(v as u64))
// Standard Error: 4_876_000
.saturating_add(Weight::from_ref_time(2_223_649_000 as u64).saturating_mul(d as u64))
Weight::from_ref_time(5_472_372_000 as u64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big jump from 0 -> 5_472_372_000

// Standard Error: 138_792
.saturating_add(Weight::from_ref_time(5_519_912 as u64).saturating_mul(v as u64))
// Standard Error: 14_189_642
.saturating_add(Weight::from_ref_time(1_536_370_329 as u64).saturating_mul(d as u64))
}
/// The range of component `v` is `[1000, 2000]`.
/// The range of component `t` is `[500, 1000]`.
/// The range of component `d` is `[5, 16]`.
fn phragmms(v: u32, _t: u32, d: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 79_000
.saturating_add(Weight::from_ref_time(14_480_000 as u64).saturating_mul(v as u64))
// Standard Error: 6_844_000
.saturating_add(Weight::from_ref_time(2_525_332_000 as u64).saturating_mul(d as u64))
Weight::from_ref_time(4_270_710_000 as u64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here from 0 -> 4_270_710_000

Copy link
Member

@ggwpez ggwpez Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even the worst case improvement is 31.8% here, so it is better now.
The crux is that the components do not start at 0, as you can see code comment above the function.
SWC now evaluates both formulas at all corners and compares them to find the worst case improvement. In this case:

27106660000  vs 18355259455 (-32.285056679797506) [d = 5, v = 1.00K]
41586660000  vs 23769227455 (-42.844105645897024) [d = 5, v = 2.00K]
54885312000  vs 37430538656 (-31.802266777676323) [d = 16, v = 1.00K]
69365312000  vs 42844506656 (-38.233527074743066) [d = 16, v = 2.00K]

// Standard Error: 142_893
.saturating_add(Weight::from_ref_time(5_413_968 as u64).saturating_mul(v as u64))
// Standard Error: 14_608_951
.saturating_add(Weight::from_ref_time(1_734_116_291 as u64).saturating_mul(d as u64))
}
}
Loading