From 7366cd137523f98b900d09c1fac34169f771567b Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Wed, 20 Dec 2023 12:55:52 +0100 Subject: [PATCH] fix weight info --- pallets/distance/src/lib.rs | 4 +- pallets/distance/src/weights.rs | 116 +++++++--------- runtime/common/src/weights/pallet_distance.rs | 130 ++++++++++++------ 3 files changed, 135 insertions(+), 115 deletions(-) diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index c5e4521eb..182039011 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -259,7 +259,7 @@ pub mod pallet { /// Request target identity to be evaluated /// only possible for unvalidated identity #[pallet::call_index(4)] - #[pallet::weight(<T as pallet::Config>::WeightInfo::request_distance_evaluation())] + #[pallet::weight(<T as pallet::Config>::WeightInfo::request_distance_evaluation_for())] pub fn request_distance_evaluation_for( origin: OriginFor<T>, target: T::IdtyIndex, @@ -317,7 +317,7 @@ pub mod pallet { /// when the evaluation completes. /// * `status.1` is the status of the evaluation. #[pallet::call_index(3)] - #[pallet::weight(<T as pallet::Config>::WeightInfo::force_set_distance_status())] + #[pallet::weight(<T as pallet::Config>::WeightInfo::force_valid_distance_status())] pub fn force_valid_distance_status( origin: OriginFor<T>, identity: <T as pallet_identity::Config>::IdtyIndex, diff --git a/pallets/distance/src/weights.rs b/pallets/distance/src/weights.rs index b0808361a..0e8f34c45 100644 --- a/pallets/distance/src/weights.rs +++ b/pallets/distance/src/weights.rs @@ -20,102 +20,82 @@ use frame_support::weights::{constants::RocksDbWeight, Weight}; pub trait WeightInfo { fn request_distance_evaluation() -> Weight; + fn request_distance_evaluation_for() -> Weight; fn update_evaluation(i: u32) -> Weight; fn force_update_evaluation(i: u32) -> Weight; - fn force_set_distance_status() -> Weight; + fn force_valid_distance_status() -> Weight; fn on_finalize() -> Weight; } // Insecure weights implementation, use it for tests only! impl WeightInfo for () { - /// Storage: Identity IdentityIndexOf (r:1 w:0) - /// Proof Skipped: Identity IdentityIndexOf (max_values: None, max_size: None, mode: Measured) - /// Storage: Distance IdentityDistanceStatus (r:1 w:1) - /// Proof Skipped: Distance IdentityDistanceStatus (max_values: None, max_size: None, mode: Measured) - /// Storage: Session CurrentIndex (r:1 w:0) - /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Distance EvaluationPool2 (r:1 w:1) - /// Proof Skipped: Distance EvaluationPool2 (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(121), added: 2596, mode: MaxEncodedLen) - /// Storage: Distance DistanceStatusExpireOn (r:1 w:1) - /// Proof Skipped: Distance DistanceStatusExpireOn (max_values: None, max_size: None, mode: Measured) fn request_distance_evaluation() -> Weight { // Proof Size summary in bytes: - // Measured: `935` - // Estimated: `4400` - // Minimum execution time: 28_469_000 picoseconds. - Weight::from_parts(30_905_000, 0) - .saturating_add(Weight::from_parts(0, 4400)) - .saturating_add(RocksDbWeight::get().reads(6)) - .saturating_add(RocksDbWeight::get().writes(4)) + // Measured: `1280` + // Estimated: `4745` + // Minimum execution time: 876_053_000 picoseconds. + Weight::from_parts(898_445_000, 0) + .saturating_add(Weight::from_parts(0, 4745)) + .saturating_add(RocksDbWeight::get().reads(8)) + .saturating_add(RocksDbWeight::get().writes(3)) + } + + fn request_distance_evaluation_for() -> Weight { + // Proof Size summary in bytes: + // Measured: `1485` + // Estimated: `7425` + // Minimum execution time: 1_118_982_000 picoseconds. + Weight::from_parts(1_292_782_000, 0) + .saturating_add(Weight::from_parts(0, 7425)) + .saturating_add(RocksDbWeight::get().reads(10)) + .saturating_add(RocksDbWeight::get().writes(3)) } - /// Storage: Distance DidUpdate (r:1 w:1) - /// Proof Skipped: Distance DidUpdate (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Authorship Author (r:1 w:1) - /// Proof: Authorship Author (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) - /// Storage: System Digest (r:1 w:0) - /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Session CurrentIndex (r:1 w:0) - /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Distance EvaluationPool0 (r:1 w:1) - /// Proof Skipped: Distance EvaluationPool0 (max_values: Some(1), max_size: None, mode: Measured) - /// The range of component `i` is `[1, 600]`. + fn update_evaluation(i: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `744 + i * (10 ±0)` - // Estimated: `2228 + i * (10 ±0)` - // Minimum execution time: 13_870_000 picoseconds. - Weight::from_parts(17_116_748, 0) - .saturating_add(Weight::from_parts(0, 2228)) - // Standard Error: 684 - .saturating_add(Weight::from_parts(128_989, 0).saturating_mul(i.into())) - .saturating_add(RocksDbWeight::get().reads(5)) + // Measured: `773 + i * (10 ±0)` + // Estimated: `2256 + i * (10 ±0)` + // Minimum execution time: 463_878_000 picoseconds. + Weight::from_parts(743_823_548, 0) + .saturating_add(Weight::from_parts(0, 2256)) + // Standard Error: 292_144 + .saturating_add(Weight::from_parts(1_326_639, 0).saturating_mul(i.into())) + .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(i.into())) } - /// Storage: Session CurrentIndex (r:1 w:0) - /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Distance EvaluationPool0 (r:1 w:1) - /// Proof Skipped: Distance EvaluationPool0 (max_values: Some(1), max_size: None, mode: Measured) - /// The range of component `i` is `[1, 600]`. + fn force_update_evaluation(i: u32) -> Weight { // Proof Size summary in bytes: // Measured: `612 + i * (10 ±0)` - // Estimated: `2096 + i * (10 ±0)` - // Minimum execution time: 8_392_000 picoseconds. - Weight::from_parts(10_825_908, 0) - .saturating_add(Weight::from_parts(0, 2096)) - // Standard Error: 326 - .saturating_add(Weight::from_parts(123_200, 0).saturating_mul(i.into())) + // Estimated: `2095 + i * (10 ±0)` + // Minimum execution time: 208_812_000 picoseconds. + Weight::from_parts(257_150_521, 0) + .saturating_add(Weight::from_parts(0, 2095)) + // Standard Error: 53_366 + .saturating_add(Weight::from_parts(1_841_329, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(i.into())) } - /// Storage: Session CurrentIndex (r:1 w:0) - /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Distance DistanceStatusExpireOn (r:1 w:1) - /// Proof Skipped: Distance DistanceStatusExpireOn (max_values: None, max_size: None, mode: Measured) - /// Storage: Distance IdentityDistanceStatus (r:0 w:1) - /// Proof Skipped: Distance IdentityDistanceStatus (max_values: None, max_size: None, mode: Measured) - fn force_set_distance_status() -> Weight { + + fn force_valid_distance_status() -> Weight { // Proof Size summary in bytes: - // Measured: `586` - // Estimated: `4051` - // Minimum execution time: 8_099_000 picoseconds. - Weight::from_parts(8_786_000, 0) - .saturating_add(Weight::from_parts(0, 4051)) - .saturating_add(RocksDbWeight::get().reads(2)) - .saturating_add(RocksDbWeight::get().writes(2)) + // Measured: `1181` + // Estimated: `7121` + // Minimum execution time: 873_892_000 picoseconds. + Weight::from_parts(1_081_510_000, 0) + .saturating_add(Weight::from_parts(0, 7121)) + .saturating_add(RocksDbWeight::get().reads(7)) + .saturating_add(RocksDbWeight::get().writes(5)) } - /// Storage: Distance DidUpdate (r:1 w:1) - /// Proof Skipped: Distance DidUpdate (max_values: Some(1), max_size: None, mode: Measured) + fn on_finalize() -> Weight { // Proof Size summary in bytes: // Measured: `170` // Estimated: `1655` - // Minimum execution time: 3_904_000 picoseconds. - Weight::from_parts(4_132_000, 0) + // Minimum execution time: 93_595_000 picoseconds. + Weight::from_parts(109_467_000, 0) .saturating_add(Weight::from_parts(0, 1655)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) diff --git a/runtime/common/src/weights/pallet_distance.rs b/runtime/common/src/weights/pallet_distance.rs index b26314cda..c1c3c8c55 100644 --- a/runtime/common/src/weights/pallet_distance.rs +++ b/runtime/common/src/weights/pallet_distance.rs @@ -17,25 +17,25 @@ //! Autogenerated weights for `pallet_distance` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-20, STEPS: `8`, REPEAT: `4`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F` +//! HOSTNAME: `squirrel`, CPU: `Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// target/release/duniter +// ./target/debug/duniter // benchmark // pallet // --chain=dev -// --steps=50 -// --repeat=20 -// --pallet=* +// --steps=8 +// --repeat=4 +// --pallet=pallet-distance // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --header=file_header.txt -// --output=runtime/common/src/weights/ +// --header=./file_header.txt +// --output=./runtime/common/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,25 +50,57 @@ pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_distance::WeightInfo for WeightInfo<T> { /// Storage: Identity IdentityIndexOf (r:1 w:0) /// Proof Skipped: Identity IdentityIndexOf (max_values: None, max_size: None, mode: Measured) - /// Storage: Distance IdentityDistanceStatus (r:1 w:1) - /// Proof Skipped: Distance IdentityDistanceStatus (max_values: None, max_size: None, mode: Measured) + /// Storage: Distance PendingEvaluationRequest (r:1 w:1) + /// Proof Skipped: Distance PendingEvaluationRequest (max_values: None, max_size: None, mode: Measured) + /// Storage: Distance ValidEvaluationResult (r:1 w:0) + /// Proof Skipped: Distance ValidEvaluationResult (max_values: None, max_size: None, mode: Measured) + /// Storage: Cert StorageIdtyCertMeta (r:1 w:0) + /// Proof Skipped: Cert StorageIdtyCertMeta (max_values: None, max_size: None, mode: Measured) + /// Storage: Parameters ParametersStorage (r:1 w:0) + /// Proof Skipped: Parameters ParametersStorage (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Session CurrentIndex (r:1 w:0) /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Distance EvaluationPool2 (r:1 w:1) /// Proof Skipped: Distance EvaluationPool2 (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(126), added: 2601, mode: MaxEncodedLen) - /// Storage: Distance DistanceStatusExpireOn (r:1 w:1) - /// Proof Skipped: Distance DistanceStatusExpireOn (max_values: None, max_size: None, mode: Measured) fn request_distance_evaluation() -> Weight { // Proof Size summary in bytes: - // Measured: `940` - // Estimated: `4405` - // Minimum execution time: 33_117_000 picoseconds. - Weight::from_parts(33_913_000, 0) - .saturating_add(Weight::from_parts(0, 4405)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `1280` + // Estimated: `4745` + // Minimum execution time: 876_053_000 picoseconds. + Weight::from_parts(898_445_000, 0) + .saturating_add(Weight::from_parts(0, 4745)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Identity IdentityIndexOf (r:1 w:0) + /// Proof Skipped: Identity IdentityIndexOf (max_values: None, max_size: None, mode: Measured) + /// Storage: Identity Identities (r:2 w:0) + /// Proof Skipped: Identity Identities (max_values: None, max_size: None, mode: Measured) + /// Storage: Distance PendingEvaluationRequest (r:1 w:1) + /// Proof Skipped: Distance PendingEvaluationRequest (max_values: None, max_size: None, mode: Measured) + /// Storage: Distance ValidEvaluationResult (r:1 w:0) + /// Proof Skipped: Distance ValidEvaluationResult (max_values: None, max_size: None, mode: Measured) + /// Storage: Cert StorageIdtyCertMeta (r:1 w:0) + /// Proof Skipped: Cert StorageIdtyCertMeta (max_values: None, max_size: None, mode: Measured) + /// Storage: Parameters ParametersStorage (r:1 w:0) + /// Proof Skipped: Parameters ParametersStorage (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Session CurrentIndex (r:1 w:0) + /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Distance EvaluationPool2 (r:1 w:1) + /// Proof Skipped: Distance EvaluationPool2 (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(126), added: 2601, mode: MaxEncodedLen) + fn request_distance_evaluation_for() -> Weight { + // Proof Size summary in bytes: + // Measured: `1485` + // Estimated: `7425` + // Minimum execution time: 1_118_982_000 picoseconds. + Weight::from_parts(1_292_782_000, 0) + .saturating_add(Weight::from_parts(0, 7425)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(3)) } /// Storage: Distance DidUpdate (r:1 w:1) /// Proof Skipped: Distance DidUpdate (max_values: Some(1), max_size: None, mode: Measured) @@ -86,12 +118,12 @@ impl<T: frame_system::Config> pallet_distance::WeightInfo for WeightInfo<T> { fn update_evaluation(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `773 + i * (10 ±0)` - // Estimated: `2257 + i * (10 ±0)` - // Minimum execution time: 19_710_000 picoseconds. - Weight::from_parts(23_931_566, 0) - .saturating_add(Weight::from_parts(0, 2257)) - // Standard Error: 329 - .saturating_add(Weight::from_parts(117_461, 0).saturating_mul(i.into())) + // Estimated: `2256 + i * (10 ±0)` + // Minimum execution time: 463_878_000 picoseconds. + Weight::from_parts(743_823_548, 0) + .saturating_add(Weight::from_parts(0, 2256)) + // Standard Error: 292_144 + .saturating_add(Weight::from_parts(1_326_639, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(i.into())) @@ -104,31 +136,39 @@ impl<T: frame_system::Config> pallet_distance::WeightInfo for WeightInfo<T> { fn force_update_evaluation(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `612 + i * (10 ±0)` - // Estimated: `2096 + i * (10 ±0)` - // Minimum execution time: 12_468_000 picoseconds. - Weight::from_parts(14_558_200, 0) - .saturating_add(Weight::from_parts(0, 2096)) - // Standard Error: 226 - .saturating_add(Weight::from_parts(115_507, 0).saturating_mul(i.into())) + // Estimated: `2095 + i * (10 ±0)` + // Minimum execution time: 208_812_000 picoseconds. + Weight::from_parts(257_150_521, 0) + .saturating_add(Weight::from_parts(0, 2095)) + // Standard Error: 53_366 + .saturating_add(Weight::from_parts(1_841_329, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(i.into())) } /// Storage: Session CurrentIndex (r:1 w:0) /// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Distance DistanceStatusExpireOn (r:1 w:1) - /// Proof Skipped: Distance DistanceStatusExpireOn (max_values: None, max_size: None, mode: Measured) - /// Storage: Distance IdentityDistanceStatus (r:0 w:1) - /// Proof Skipped: Distance IdentityDistanceStatus (max_values: None, max_size: None, mode: Measured) - fn force_set_distance_status() -> Weight { + /// Storage: Distance ValidEvaluationExpireOn (r:1 w:1) + /// Proof Skipped: Distance ValidEvaluationExpireOn (max_values: None, max_size: None, mode: Measured) + /// Storage: Identity Identities (r:1 w:0) + /// Proof Skipped: Identity Identities (max_values: None, max_size: None, mode: Measured) + /// Storage: Membership Membership (r:1 w:1) + /// Proof Skipped: Membership Membership (max_values: None, max_size: None, mode: Measured) + /// Storage: Membership MembershipsExpireOn (r:2 w:2) + /// Proof Skipped: Membership MembershipsExpireOn (max_values: None, max_size: None, mode: Measured) + /// Storage: Parameters ParametersStorage (r:1 w:0) + /// Proof Skipped: Parameters ParametersStorage (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Distance ValidEvaluationResult (r:0 w:1) + /// Proof Skipped: Distance ValidEvaluationResult (max_values: None, max_size: None, mode: Measured) + fn force_valid_distance_status() -> Weight { // Proof Size summary in bytes: - // Measured: `586` - // Estimated: `4051` - // Minimum execution time: 12_950_000 picoseconds. - Weight::from_parts(13_434_000, 0) - .saturating_add(Weight::from_parts(0, 4051)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `1181` + // Estimated: `7121` + // Minimum execution time: 873_892_000 picoseconds. + Weight::from_parts(1_081_510_000, 0) + .saturating_add(Weight::from_parts(0, 7121)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: Distance DidUpdate (r:1 w:1) /// Proof Skipped: Distance DidUpdate (max_values: Some(1), max_size: None, mode: Measured) @@ -136,8 +176,8 @@ impl<T: frame_system::Config> pallet_distance::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `170` // Estimated: `1655` - // Minimum execution time: 3_781_000 picoseconds. - Weight::from_parts(4_122_000, 0) + // Minimum execution time: 93_595_000 picoseconds. + Weight::from_parts(109_467_000, 0) .saturating_add(Weight::from_parts(0, 1655)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) -- GitLab