Skip to content

Commit

Permalink
try making bench numbers make sense (#5526)
Browse files Browse the repository at this point in the history
Follow-up to #5270. The baseline numbers for Westend were too high to be
representative of the reality as it seemed to do with how multi-variate
linear regression is calculated.

---------

Co-authored-by: command-bot <>
  • Loading branch information
ordian committed Sep 4, 2024
1 parent cc3b7bb commit de0b6f2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 48 deletions.
4 changes: 2 additions & 2 deletions polkadot/runtime/parachains/src/inclusion/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ benchmarks! {
}

enact_candidate {
let u in 1 .. 32;
let h in 1 .. 32;
let u in 0 .. 2;
let h in 0 .. 2;
let c in 0 .. 1;

let para = 42_u32.into(); // not especially important.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `polkadot_runtime_parachains::inclusion`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-696hpswk-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-svzsllib-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -70,13 +70,13 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::inclusion::WeightInfo
/// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(55), added: 2530, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::Pages` (r:1 w:32)
/// Storage: `MessageQueue::Pages` (r:1 w:10)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32818), added: 35293, mode: `MaxEncodedLen`)
/// Storage: `Hrmp::HrmpChannelDigests` (r:33 w:33)
/// Storage: `Hrmp::HrmpChannelDigests` (r:11 w:11)
/// Proof: `Hrmp::HrmpChannelDigests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpChannels` (r:32 w:32)
/// Storage: `Hrmp::HrmpChannels` (r:10 w:10)
/// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpChannelContents` (r:32 w:32)
/// Storage: `Hrmp::HrmpChannelContents` (r:10 w:10)
/// Proof: `Hrmp::HrmpChannelContents` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::FutureCodeUpgrades` (r:1 w:0)
/// Proof: `Paras::FutureCodeUpgrades` (`max_values`: None, `max_size`: None, mode: `Measured`)
Expand All @@ -96,28 +96,31 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::inclusion::WeightInfo
/// Proof: `Paras::UpgradeRestrictionSignal` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
/// Proof: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
/// The range of component `u` is `[1, 32]`.
/// The range of component `h` is `[1, 32]`.
/// The range of component `u` is `[0, 10]`.
/// The range of component `h` is `[0, 10]`.
/// The range of component `c` is `[0, 1]`.
fn enact_candidate(u: u32, h: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `33353 + c * (16114 ±0) + h * (75 ±0)`
// Estimated: `36818 + c * (26467 ±0) + h * (2551 ±0)`
// Minimum execution time: 4_829_551_000 picoseconds.
Weight::from_parts(1_892_697_027, 0)
.saturating_add(Weight::from_parts(0, 36818))
// Standard Error: 793_993
.saturating_add(Weight::from_parts(126_698_671, 0).saturating_mul(u.into()))
// Standard Error: 793_993
.saturating_add(Weight::from_parts(144_116_038, 0).saturating_mul(h.into()))
.saturating_add(T::DbWeight::get().reads(7))
// Measured: `33352 + c * (16115 ±0) + h * (76 ±0)`
// Estimated: `36283 + c * (19327 ±403) + h * (3057 ±59) + u * (1314 ±59)`
// Minimum execution time: 1_334_017_000 picoseconds.
Weight::from_parts(5_805_317, 0)
.saturating_add(Weight::from_parts(0, 36283))
// Standard Error: 282_194
.saturating_add(Weight::from_parts(128_332_196, 0).saturating_mul(u.into()))
// Standard Error: 282_194
.saturating_add(Weight::from_parts(146_910_684, 0).saturating_mul(h.into()))
// Standard Error: 1_905_330
.saturating_add(Weight::from_parts(91_514_854, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(h.into())))
.saturating_add(T::DbWeight::get().reads((8_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(10))
.saturating_add(T::DbWeight::get().writes(8))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(h.into())))
.saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 26467).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 2551).saturating_mul(h.into()))
.saturating_add(Weight::from_parts(0, 19327).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 3057).saturating_mul(h.into()))
.saturating_add(Weight::from_parts(0, 1314).saturating_mul(u.into()))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `polkadot_runtime_parachains::inclusion`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-696hpswk-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-svzsllib-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -80,13 +80,13 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::inclusion::WeightInfo
/// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(55), added: 2530, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::Pages` (r:1 w:32)
/// Storage: `MessageQueue::Pages` (r:1 w:2)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(131122), added: 133597, mode: `MaxEncodedLen`)
/// Storage: `Hrmp::HrmpChannelDigests` (r:33 w:33)
/// Storage: `Hrmp::HrmpChannelDigests` (r:3 w:3)
/// Proof: `Hrmp::HrmpChannelDigests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpChannels` (r:32 w:32)
/// Storage: `Hrmp::HrmpChannels` (r:2 w:2)
/// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpChannelContents` (r:32 w:32)
/// Storage: `Hrmp::HrmpChannelContents` (r:2 w:2)
/// Proof: `Hrmp::HrmpChannelContents` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::FutureCodeUpgrades` (r:1 w:0)
/// Proof: `Paras::FutureCodeUpgrades` (`max_values`: None, `max_size`: None, mode: `Measured`)
Expand All @@ -104,28 +104,32 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::inclusion::WeightInfo
/// Proof: `Paras::UpgradeRestrictionSignal` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
/// Proof: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
/// The range of component `u` is `[1, 32]`.
/// The range of component `h` is `[1, 32]`.
/// The range of component `u` is `[0, 2]`.
/// The range of component `h` is `[0, 2]`.
/// The range of component `c` is `[0, 1]`.
fn enact_candidate(u: u32, h: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `132737 + c * (15992 ±0) + h * (75 ±0)`
// Estimated: `136202 + c * (76098 ±0) + h * (2551 ±0)`
// Minimum execution time: 18_868_930_000 picoseconds.
Weight::from_parts(6_899_601_016, 0)
.saturating_add(Weight::from_parts(0, 136202))
// Standard Error: 1_952_665
.saturating_add(Weight::from_parts(467_810_135, 0).saturating_mul(u.into()))
// Standard Error: 1_952_665
.saturating_add(Weight::from_parts(551_226_340, 0).saturating_mul(h.into()))
.saturating_add(T::DbWeight::get().reads(11))
// Measured: `1447 + c * (15992 ±0) + h * (92 ±0) + u * (131259 ±0)`
// Estimated: `134587 + c * (25419 ±939) + h * (29985 ±511) + u * (82828 ±511)`
// Minimum execution time: 1_065_780_000 picoseconds.
Weight::from_parts(192_328_221, 0)
.saturating_add(Weight::from_parts(0, 134587))
// Standard Error: 1_263_527
.saturating_add(Weight::from_parts(454_948_671, 0).saturating_mul(u.into()))
// Standard Error: 1_263_527
.saturating_add(Weight::from_parts(527_131_211, 0).saturating_mul(h.into()))
// Standard Error: 2_093_815
.saturating_add(Weight::from_parts(11_112_489, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(h.into())))
.saturating_add(T::DbWeight::get().reads((8_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(11))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(h.into())))
.saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 76098).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 2551).saturating_mul(h.into()))
.saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(6))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(h.into())))
.saturating_add(T::DbWeight::get().writes((8_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 25419).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 29985).saturating_mul(h.into()))
.saturating_add(Weight::from_parts(0, 82828).saturating_mul(u.into()))
}
}
13 changes: 13 additions & 0 deletions prdoc/pr_5526.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: "Fix enact_candidate weight generation"
doc:
- audience: Runtime Dev
description: |
This PR works around an issue in multivariate linear regression of weight generation.

crates:
- name: polkadot-runtime-parachains
bump: patch
- name: rococo-runtime
bump: patch
- name: westend-runtime
bump: patch

0 comments on commit de0b6f2

Please sign in to comment.