diff --git a/Cargo.lock b/Cargo.lock index 0d4eddf4f954d..1d61de7fb2285 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4623,6 +4623,7 @@ dependencies = [ name = "cumulus-pallet-xcmp-queue" version = "0.7.1" dependencies = [ + "approx", "bounded-collections", "bp-xcm-bridge-hub-router", "cumulus-pallet-parachain-system", diff --git a/cumulus/pallets/xcmp-queue/Cargo.toml b/cumulus/pallets/xcmp-queue/Cargo.toml index 47dd3b3b9ddbe..7a8b13c5db7cb 100644 --- a/cumulus/pallets/xcmp-queue/Cargo.toml +++ b/cumulus/pallets/xcmp-queue/Cargo.toml @@ -34,6 +34,8 @@ xcm-executor = { workspace = true } # Cumulus cumulus-primitives-core = { workspace = true } +# Optional import for weight accuracy testing +approx = { workspace = true } # Optional import for benchmarking bounded-collections = { workspace = true } frame-benchmarking = { optional = true, workspace = true } @@ -53,6 +55,7 @@ cumulus-pallet-parachain-system = { workspace = true, default-features = true } [features] default = ["std"] std = [ + "approx/std", "bounded-collections/std", "bp-xcm-bridge-hub-router?/std", "codec/std", diff --git a/cumulus/pallets/xcmp-queue/src/benchmarking.rs b/cumulus/pallets/xcmp-queue/src/benchmarking.rs index ba4b3ac7801f0..55916c5513b57 100644 --- a/cumulus/pallets/xcmp-queue/src/benchmarking.rs +++ b/cumulus/pallets/xcmp-queue/src/benchmarking.rs @@ -15,7 +15,7 @@ //! Benchmarking setup for cumulus-pallet-xcmp-queue -use crate::*; +use crate::{weights_ext::get_average_page_pos, *}; use alloc::vec; use codec::DecodeAll; @@ -107,6 +107,40 @@ mod benchmarks { } } + /// Add an XCMP message of 0 bytes to the message queue at the provided position + /// on an existing page. + #[benchmark] + fn enqueue_empty_xcmp_message_at( + n: Linear<0, { crate::MaxXcmpMessageLenOf::::get() - 10 }>, + ) { + #[cfg(test)] + { + mock::EnqueuedMessages::set(vec![]); + } + + assert_ok!(Pallet::::enqueue_xcmp_messages( + 0.into(), + &[BoundedVec::try_from(vec![0; n as usize]).unwrap()], + &mut WeightMeter::new() + )); + + #[cfg(not(test))] + let fp_before = T::XcmpQueue::footprint(0.into()); + #[block] + { + assert_ok!(Pallet::::enqueue_xcmp_messages( + 0.into(), + &[Default::default()], + &mut WeightMeter::new() + )); + } + #[cfg(not(test))] + { + let fp_after = T::XcmpQueue::footprint(0.into()); + assert_eq!(fp_after.ready_pages, fp_before.ready_pages); + } + } + /// Add `n` pages to the message queue. /// /// We add one page by enqueueing a maximal size message which fills it. @@ -157,6 +191,17 @@ mod benchmarks { }); } + assert_ok!(Pallet::::enqueue_xcmp_messages( + 0.into(), + &[BoundedVec::try_from(vec![ + 0; + get_average_page_pos(MaxXcmpMessageLenOf::::get()) + as usize + ]) + .unwrap()], + &mut WeightMeter::new() + )); + let mut msgs = vec![]; for _i in 0..1000 { msgs.push(BoundedVec::try_from(vec![0; 3]).unwrap()); @@ -175,7 +220,7 @@ mod benchmarks { #[cfg(not(test))] { let fp_after = T::XcmpQueue::footprint(0.into()); - assert_eq!(fp_after.ready_pages, fp_before.ready_pages + 1); + assert_eq!(fp_after.ready_pages, fp_before.ready_pages); } } diff --git a/cumulus/pallets/xcmp-queue/src/lib.rs b/cumulus/pallets/xcmp-queue/src/lib.rs index f25df746aefc7..b703ae7fc944c 100644 --- a/cumulus/pallets/xcmp-queue/src/lib.rs +++ b/cumulus/pallets/xcmp-queue/src/lib.rs @@ -51,8 +51,6 @@ pub mod weights; pub mod weights_ext; pub use weights::WeightInfo; -#[cfg(feature = "std")] -pub use weights_ext::check_weight_info_ext_accuracy; pub use weights_ext::WeightInfoExt; extern crate alloc; @@ -68,8 +66,8 @@ use cumulus_primitives_core::{ use frame_support::{ defensive, defensive_assert, traits::{ - BatchFootprint, Defensive, EnqueueMessage, EnsureOrigin, Get, QueueFootprint, - QueueFootprintQuery, QueuePausedQuery, + Defensive, EnqueueMessage, EnsureOrigin, Get, QueueFootprint, QueueFootprintQuery, + QueuePausedQuery, }, weights::{Weight, WeightMeter}, BoundedVec, @@ -79,7 +77,7 @@ use polkadot_runtime_common::xcm_sender::PriceForMessageDelivery; use polkadot_runtime_parachains::{FeeTracker, GetMinFeeFactor}; use scale_info::TypeInfo; use sp_core::MAX_POSSIBLE_ALLOCATION; -use sp_runtime::{FixedU128, RuntimeDebug, WeakBoundedVec}; +use sp_runtime::{FixedU128, RuntimeDebug, SaturatedConversion, WeakBoundedVec}; use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH}; use xcm_builder::InspectMessageQueues; use xcm_executor::traits::ConvertOrigin; @@ -264,9 +262,13 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { fn integrity_test() { + assert!(!T::MaxPageSize::get().is_zero(), "MaxPageSize too low"); + let w = Self::on_idle_weight(); assert!(w != Weight::zero()); assert!(w.all_lte(T::BlockWeights::get().max_block)); + + ::check_accuracy::>(0.15); } fn on_idle(_block: BlockNumberFor, limit: Weight) -> Weight { @@ -643,13 +645,10 @@ impl Pallet { drop_threshold, ); - // `batches_footprints[n]` contains the footprint of the batch `xcms[0..n]`, - // so as `n` increases `batches_footprints[n]` contains the footprint of a bigger batch. - let best_batch_idx = batches_footprints.binary_search_by(|batch_info| { + let best_batch_footprint = batches_footprints.search_best_by(|batch_info| { let required_weight = T::WeightInfo::enqueue_xcmp_messages( - batch_info.new_pages_count, - batch_info.msgs_count, - batch_info.size_in_bytes, + batches_footprints.first_page_pos.saturated_into(), + batch_info, ); match meter.can_consume(required_weight) { @@ -657,25 +656,10 @@ impl Pallet { false => core::cmp::Ordering::Greater, } }); - let best_batch_idx = match best_batch_idx { - Ok(last_ok_idx) => { - // We should never reach this branch since we never return `Ordering::Equal`. - defensive!("Unexpected best_batch_idx found: Ok({})", last_ok_idx); - Some(last_ok_idx) - }, - Err(first_err_idx) => first_err_idx.checked_sub(1), - }; - let best_batch_footprint = match best_batch_idx { - Some(best_batch_idx) => batches_footprints.get(best_batch_idx).ok_or_else(|| { - defensive!("Invalid best_batch_idx: {}", best_batch_idx); - })?, - None => &BatchFootprint { msgs_count: 0, size_in_bytes: 0, new_pages_count: 0 }, - }; meter.consume(T::WeightInfo::enqueue_xcmp_messages( - best_batch_footprint.new_pages_count, - best_batch_footprint.msgs_count, - best_batch_footprint.size_in_bytes, + batches_footprints.first_page_pos.saturated_into(), + best_batch_footprint, )); T::XcmpQueue::enqueue_messages( xcms.iter() diff --git a/cumulus/pallets/xcmp-queue/src/mock.rs b/cumulus/pallets/xcmp-queue/src/mock.rs index 7c8bdad50fa2c..f975c50918153 100644 --- a/cumulus/pallets/xcmp-queue/src/mock.rs +++ b/cumulus/pallets/xcmp-queue/src/mock.rs @@ -20,7 +20,7 @@ use cumulus_pallet_parachain_system::AnyRelayNumber; use cumulus_primitives_core::{ChannelInfo, IsSystem, ParaId}; use frame_support::{ derive_impl, parameter_types, - traits::{ConstU32, Everything, OriginTrait}, + traits::{BatchesFootprints, ConstU32, Everything, OriginTrait}, BoundedSlice, }; use frame_system::EnsureRoot; @@ -193,24 +193,16 @@ impl> QueueFootprintQuery for EnqueueToLocalSt origin: ParaId, msgs: impl Iterator>, total_pages_limit: u32, - ) -> Vec { + ) -> BatchesFootprints { // Let's consider that we add one message per page let footprint = Self::footprint(origin); - let mut batches_footprints = vec![]; - let mut new_pages_count = 0; - let mut total_size = 0; + let mut batches_footprints = BatchesFootprints::default(); for (idx, msg) in msgs.enumerate() { - new_pages_count += 1; - if footprint.pages + new_pages_count > total_pages_limit { + if footprint.pages + idx as u32 + 1 > total_pages_limit { break; } - total_size += msg.len(); - batches_footprints.push(BatchFootprint { - msgs_count: idx + 1, - size_in_bytes: total_size, - new_pages_count, - }) + batches_footprints.push(msg.into(), true); } batches_footprints } diff --git a/cumulus/pallets/xcmp-queue/src/tests.rs b/cumulus/pallets/xcmp-queue/src/tests.rs index a87bf6c1dbbe5..cefbe401df1d7 100644 --- a/cumulus/pallets/xcmp-queue/src/tests.rs +++ b/cumulus/pallets/xcmp-queue/src/tests.rs @@ -22,7 +22,8 @@ use XcmpMessageFormat::*; use codec::Input; use cumulus_primitives_core::{ParaId, XcmpMessageHandler}; use frame_support::{ - assert_err, assert_noop, assert_ok, assert_storage_noop, hypothetically, traits::Hooks, + assert_err, assert_noop, assert_ok, assert_storage_noop, hypothetically, + traits::{BatchFootprint, Hooks}, StorageNoopGuard, }; use mock::{new_test_ext, ParachainSystem, RuntimeOrigin as Origin, Test, XcmpQueue}; @@ -210,9 +211,12 @@ fn xcm_enqueueing_starts_dropping_on_out_of_weight() { total_size += xcm.len(); let required_weight = <::WeightInfo>::enqueue_xcmp_messages( - idx as u32 + 1, - idx + 1, - total_size, + 0, + &BatchFootprint { + msgs_count: idx + 1, + size_in_bytes: total_size, + new_pages_count: idx as u32 + 1, + }, ); let mut weight_meter = WeightMeter::with_limit(required_weight); diff --git a/cumulus/pallets/xcmp-queue/src/weights.rs b/cumulus/pallets/xcmp-queue/src/weights.rs index 6a199ede60866..5ae717a164bbb 100644 --- a/cumulus/pallets/xcmp-queue/src/weights.rs +++ b/cumulus/pallets/xcmp-queue/src/weights.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-03-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `serban-ROG-Zephyrus`, CPU: `AMD Ryzen 9 7945HX with Radeon Graphics` +//! HOSTNAME: `Serbans-MacBook-Pro.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: `1024` // Executed Command: @@ -50,6 +50,7 @@ pub trait WeightInfo { fn set_config_with_u32() -> Weight; fn enqueue_n_bytes_xcmp_message(n: u32, ) -> Weight; fn enqueue_n_empty_xcmp_messages(n: u32, ) -> Weight; + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight; fn enqueue_n_full_pages(n: u32, ) -> Weight; fn enqueue_1000_small_xcmp_messages() -> Weight; fn suspend_channel() -> Weight; @@ -68,8 +69,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1497` - // Minimum execution time: 3_562_000 picoseconds. - Weight::from_parts(4_749_000, 1497) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 1497) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -88,10 +89,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 10_685_000 picoseconds. - Weight::from_parts(8_747_868, 5487) - // Standard Error: 6 - .saturating_add(Weight::from_parts(696, 0).saturating_mul(n.into())) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_115_841, 5487) + // Standard Error: 1 + .saturating_add(Weight::from_parts(155, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -110,10 +111,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 9_498_000 picoseconds. - Weight::from_parts(14_113_868, 5487) - // Standard Error: 298 - .saturating_add(Weight::from_parts(109_652, 0).saturating_mul(n.into())) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_987_577, 5487) + // Standard Error: 313 + .saturating_add(Weight::from_parts(94_980, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -121,6 +122,26 @@ impl WeightInfo for SubstrateWeight { /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_015_940, 108986) + // Standard Error: 32 + .saturating_add(Weight::from_parts(911, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -132,10 +153,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `186` // Estimated: `5487` - // Minimum execution time: 10_685_000 picoseconds. - Weight::from_parts(10_686_000, 5487) - // Standard Error: 51_426 - .saturating_add(Weight::from_parts(64_394_224, 0).saturating_mul(n.into())) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 5487) + // Standard Error: 20_150 + .saturating_add(Weight::from_parts(20_690_483, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -144,20 +165,18 @@ impl WeightInfo for SubstrateWeight { /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `151` - // Estimated: `5487` - // Minimum execution time: 118_730_000 picoseconds. - Weight::from_parts(123_480_000, 5487) + // Measured: `53067` + // Estimated: `108986` + // Minimum execution time: 139_000_000 picoseconds. + Weight::from_parts(148_000_000, 108986) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -165,8 +184,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `2767` - // Minimum execution time: 2_374_000 picoseconds. - Weight::from_parts(3_562_000, 2767) + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_000_000, 2767) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -176,8 +195,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `2767` - // Minimum execution time: 3_561_000 picoseconds. - Weight::from_parts(4_749_000, 2767) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 2767) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -185,8 +204,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_749_000 picoseconds. - Weight::from_parts(5_937_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -206,8 +225,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `105716` // Estimated: `109181` - // Minimum execution time: 131_791_000 picoseconds. - Weight::from_parts(134_166_000, 109181) + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(71_000_000, 109181) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -229,8 +248,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `65785` // Estimated: `69250` - // Minimum execution time: 80_737_000 picoseconds. - Weight::from_parts(83_111_000, 69250) + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(45_000_000, 69250) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -244,8 +263,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1497` - // Minimum execution time: 3_562_000 picoseconds. - Weight::from_parts(4_749_000, 1497) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 1497) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -264,10 +283,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 10_685_000 picoseconds. - Weight::from_parts(8_747_868, 5487) - // Standard Error: 6 - .saturating_add(Weight::from_parts(696, 0).saturating_mul(n.into())) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_115_841, 5487) + // Standard Error: 1 + .saturating_add(Weight::from_parts(155, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -286,10 +305,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 9_498_000 picoseconds. - Weight::from_parts(14_113_868, 5487) - // Standard Error: 298 - .saturating_add(Weight::from_parts(109_652, 0).saturating_mul(n.into())) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_987_577, 5487) + // Standard Error: 313 + .saturating_add(Weight::from_parts(94_980, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -297,6 +316,26 @@ impl WeightInfo for () { /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_015_940, 108986) + // Standard Error: 32 + .saturating_add(Weight::from_parts(911, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -308,10 +347,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `186` // Estimated: `5487` - // Minimum execution time: 10_685_000 picoseconds. - Weight::from_parts(10_686_000, 5487) - // Standard Error: 51_426 - .saturating_add(Weight::from_parts(64_394_224, 0).saturating_mul(n.into())) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 5487) + // Standard Error: 20_150 + .saturating_add(Weight::from_parts(20_690_483, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -320,20 +359,18 @@ impl WeightInfo for () { /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `151` - // Estimated: `5487` - // Minimum execution time: 118_730_000 picoseconds. - Weight::from_parts(123_480_000, 5487) + // Measured: `53067` + // Estimated: `108986` + // Minimum execution time: 139_000_000 picoseconds. + Weight::from_parts(148_000_000, 108986) .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -341,8 +378,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `2767` - // Minimum execution time: 2_374_000 picoseconds. - Weight::from_parts(3_562_000, 2767) + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_000_000, 2767) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -352,8 +389,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `2767` - // Minimum execution time: 3_561_000 picoseconds. - Weight::from_parts(4_749_000, 2767) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 2767) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -361,8 +398,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_749_000 picoseconds. - Weight::from_parts(5_937_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -382,8 +419,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `105716` // Estimated: `109181` - // Minimum execution time: 131_791_000 picoseconds. - Weight::from_parts(134_166_000, 109181) + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(71_000_000, 109181) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -405,8 +442,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `65785` // Estimated: `69250` - // Minimum execution time: 80_737_000 picoseconds. - Weight::from_parts(83_111_000, 69250) + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(45_000_000, 69250) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/cumulus/pallets/xcmp-queue/src/weights_ext.rs b/cumulus/pallets/xcmp-queue/src/weights_ext.rs index 707b9ff3af252..15b9e3eaf1d64 100644 --- a/cumulus/pallets/xcmp-queue/src/weights_ext.rs +++ b/cumulus/pallets/xcmp-queue/src/weights_ext.rs @@ -17,31 +17,31 @@ use crate::weights::WeightInfo; -use frame_support::weights::Weight; +use frame_support::{traits::BatchFootprint, weights::Weight}; use sp_runtime::SaturatedConversion; +pub(crate) fn get_average_page_pos(max_message_len: u32) -> u32 { + max_message_len / 2 +} + /// Extended weight info. pub trait WeightInfoExt: WeightInfo { fn uncached_enqueue_xcmp_messages() -> Weight { Self::enqueue_n_full_pages(0) } - fn enqueue_xcmp_messages( - new_pages_count: u32, - message_count: usize, - size_in_bytes: usize, - ) -> Weight { - let message_count = message_count.saturated_into(); - let size_in_bytes = size_in_bytes.saturated_into(); + fn enqueue_xcmp_messages(first_page_pos: u32, batch_footprint: &BatchFootprint) -> Weight { + let message_count = batch_footprint.msgs_count.saturated_into(); + let size_in_bytes = batch_footprint.size_in_bytes.saturated_into(); // The cost of adding `n` empty pages on the message queue. let pages_overhead = { let full_message_overhead = Self::enqueue_n_full_pages(1) .saturating_sub(Self::enqueue_n_empty_xcmp_messages(1)); let n_full_messages_overhead = - full_message_overhead.saturating_mul(new_pages_count as u64); + full_message_overhead.saturating_mul(batch_footprint.new_pages_count as u64); - Self::enqueue_n_full_pages(new_pages_count) + Self::enqueue_n_full_pages(batch_footprint.new_pages_count) .saturating_sub(Self::enqueue_n_full_pages(0)) .saturating_sub(n_full_messages_overhead) }; @@ -58,36 +58,36 @@ pub trait WeightInfoExt: WeightInfo { .saturating_sub(Self::enqueue_n_bytes_xcmp_message(0)) }; - pages_overhead.saturating_add(messages_overhead).saturating_add(bytes_overhead) - } -} - -impl WeightInfoExt for T {} - -#[cfg(feature = "std")] -pub fn check_weight_info_ext_accuracy(err_margin: u8) { - assert!(err_margin < 100); - let err_margin = err_margin as u64; - - let estimated_weight = - T::uncached_enqueue_xcmp_messages().saturating_add(T::enqueue_xcmp_messages(1, 1000, 3000)); - let actual_weight = T::enqueue_1000_small_xcmp_messages(); - - // Check that the ref_time diff is less than {err_margin}% - let diff_ref_time = estimated_weight.ref_time().abs_diff(actual_weight.ref_time()); - assert!(diff_ref_time < estimated_weight.ref_time() * err_margin / 100); - assert!(diff_ref_time < actual_weight.ref_time() * err_margin / 100); - - // The proof sizes should be the same - assert_eq!(estimated_weight.proof_size(), actual_weight.proof_size()); -} + // If the messages are not added to the beginning of the first page, the page will be + // decoded and re-encoded once. Let's account for this. + let pos_overhead = { + Self::enqueue_empty_xcmp_message_at(first_page_pos) + .saturating_sub(Self::enqueue_empty_xcmp_message_at(0)) + }; -#[cfg(test)] -mod tests { - use super::*; + pages_overhead + .saturating_add(messages_overhead) + .saturating_add(bytes_overhead) + .saturating_add(pos_overhead) + } - #[test] - fn weight_info_ext_accuracy_is_high() { - check_weight_info_ext_accuracy::<()>(5); + fn check_accuracy>(err_margin: f64) { + assert!(err_margin < 1f64); + + let estimated_weight = + Self::uncached_enqueue_xcmp_messages().saturating_add(Self::enqueue_xcmp_messages( + get_average_page_pos(MaxMessageLen::get()), + &BatchFootprint { msgs_count: 1000, size_in_bytes: 3000, new_pages_count: 0 }, + )); + let actual_weight = Self::enqueue_1000_small_xcmp_messages(); + + // Check that the ref_time diff is less than err_margin + approx::assert_relative_eq!( + estimated_weight.ref_time() as f64, + actual_weight.ref_time() as f64, + max_relative = err_margin + ); } } + +impl WeightInfoExt for T {} diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs index 7f46872794d27..ddc76fe451ad6 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `109` // Estimated: `1497` - // Minimum execution time: 5_097_000 picoseconds. - Weight::from_parts(5_350_000, 0) + // Minimum execution time: 4_908_000 picoseconds. + Weight::from_parts(5_133_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 13_341_000 picoseconds. - Weight::from_parts(9_919_192, 0) + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(9_457_298, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(957, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_016, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 11_576_000 picoseconds. - Weight::from_parts(15_601_069, 0) + // Minimum execution time: 11_593_000 picoseconds. + Weight::from_parts(15_263_900, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 140 - .saturating_add(Weight::from_parts(113_132, 0).saturating_mul(n.into())) + // Standard Error: 239 + .saturating_add(Weight::from_parts(136_065, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 20_217_000 picoseconds. + Weight::from_parts(20_647_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_576, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `186` // Estimated: `5487` - // Minimum execution time: 13_047_000 picoseconds. - Weight::from_parts(13_317_000, 0) + // Minimum execution time: 13_262_000 picoseconds. + Weight::from_parts(13_670_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 88_289 - .saturating_add(Weight::from_parts(92_149_747, 0).saturating_mul(n.into())) + // Standard Error: 81_154 + .saturating_add(Weight::from_parts(105_979_285, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `151` - // Estimated: `5487` - // Minimum execution time: 129_728_000 picoseconds. - Weight::from_parts(130_337_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `53067` + // Estimated: `108986` + // Minimum execution time: 289_304_000 picoseconds. + Weight::from_parts(299_215_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `109` // Estimated: `2767` - // Minimum execution time: 3_209_000 picoseconds. - Weight::from_parts(3_333_000, 0) + // Minimum execution time: 3_121_000 picoseconds. + Weight::from_parts(3_254_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `144` // Estimated: `2767` - // Minimum execution time: 4_438_000 picoseconds. - Weight::from_parts(4_553_000, 0) + // Minimum execution time: 4_409_000 picoseconds. + Weight::from_parts(4_555_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_198_000 picoseconds. - Weight::from_parts(5_520_000, 0) + // Minimum execution time: 5_368_000 picoseconds. + Weight::from_parts(5_614_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105716` // Estimated: `109181` - // Minimum execution time: 205_600_000 picoseconds. - Weight::from_parts(210_403_000, 0) + // Minimum execution time: 231_957_000 picoseconds. + Weight::from_parts(242_676_000, 0) .saturating_add(Weight::from_parts(0, 109181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65785` // Estimated: `69250` - // Minimum execution time: 125_352_000 picoseconds. - Weight::from_parts(129_052_000, 0) + // Minimum execution time: 134_722_000 picoseconds. + Weight::from_parts(138_495_000, 0) .saturating_add(Weight::from_parts(0, 69250)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs index d327ed420b844..a3e0129468d65 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `109` // Estimated: `1497` - // Minimum execution time: 5_079_000 picoseconds. - Weight::from_parts(5_370_000, 0) + // Minimum execution time: 4_883_000 picoseconds. + Weight::from_parts(5_223_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 13_631_000 picoseconds. - Weight::from_parts(9_312_672, 0) + // Minimum execution time: 13_840_000 picoseconds. + Weight::from_parts(8_982_973, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(1_016, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(995, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` - // Minimum execution time: 11_412_000 picoseconds. - Weight::from_parts(15_650_229, 0) + // Minimum execution time: 12_129_000 picoseconds. + Weight::from_parts(15_937_292, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 221 - .saturating_add(Weight::from_parts(114_484, 0).saturating_mul(n.into())) + // Standard Error: 225 + .saturating_add(Weight::from_parts(115_324, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 20_484_000 picoseconds. + Weight::from_parts(20_648_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 11 + .saturating_add(Weight::from_parts(2_365, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `186` // Estimated: `5487` - // Minimum execution time: 12_757_000 picoseconds. - Weight::from_parts(1_315_914, 0) + // Minimum execution time: 12_963_000 picoseconds. + Weight::from_parts(13_277_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 85_840 - .saturating_add(Weight::from_parts(94_451_417, 0).saturating_mul(n.into())) + // Standard Error: 63_306 + .saturating_add(Weight::from_parts(104_765_134, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `151` - // Estimated: `5487` - // Minimum execution time: 129_219_000 picoseconds. - Weight::from_parts(130_403_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `53067` + // Estimated: `108986` + // Minimum execution time: 255_661_000 picoseconds. + Weight::from_parts(264_825_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `109` // Estimated: `2767` - // Minimum execution time: 3_134_000 picoseconds. - Weight::from_parts(3_280_000, 0) + // Minimum execution time: 3_092_000 picoseconds. + Weight::from_parts(3_339_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `144` // Estimated: `2767` - // Minimum execution time: 4_413_000 picoseconds. - Weight::from_parts(4_663_000, 0) + // Minimum execution time: 4_352_000 picoseconds. + Weight::from_parts(4_577_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_388_000 picoseconds. - Weight::from_parts(5_509_000, 0) + // Minimum execution time: 5_050_000 picoseconds. + Weight::from_parts(5_270_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105716` // Estimated: `109181` - // Minimum execution time: 223_167_000 picoseconds. - Weight::from_parts(225_720_000, 0) + // Minimum execution time: 210_820_000 picoseconds. + Weight::from_parts(221_925_000, 0) .saturating_add(Weight::from_parts(0, 109181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65785` // Estimated: `69250` - // Minimum execution time: 131_073_000 picoseconds. - Weight::from_parts(132_760_000, 0) + // Minimum execution time: 127_555_000 picoseconds. + Weight::from_parts(130_147_000, 0) .saturating_add(Weight::from_parts(0, 69250)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs index 1ffad7087da69..40f13c7090b47 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `4` // Estimated: `1497` - // Minimum execution time: 4_386_000 picoseconds. - Weight::from_parts(4_636_000, 0) + // Minimum execution time: 4_326_000 picoseconds. + Weight::from_parts(4_616_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `80` // Estimated: `5487` - // Minimum execution time: 13_325_000 picoseconds. - Weight::from_parts(9_602_752, 0) + // Minimum execution time: 13_374_000 picoseconds. + Weight::from_parts(9_220_505, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(948, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(989, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `80` // Estimated: `5487` - // Minimum execution time: 11_096_000 picoseconds. - Weight::from_parts(15_516_116, 0) + // Minimum execution time: 11_436_000 picoseconds. + Weight::from_parts(15_588_934, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 320 - .saturating_add(Weight::from_parts(116_120, 0).saturating_mul(n.into())) + // Standard Error: 215 + .saturating_add(Weight::from_parts(121_183, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `263 + n * (1 ±0)` + // Estimated: `109014` + // Minimum execution time: 21_929_000 picoseconds. + Weight::from_parts(1_150_129, 0) + .saturating_add(Weight::from_parts(0, 109014)) + // Standard Error: 16 + .saturating_add(Weight::from_parts(2_654, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `115` // Estimated: `5487` - // Minimum execution time: 12_507_000 picoseconds. - Weight::from_parts(12_840_000, 0) + // Minimum execution time: 12_994_000 picoseconds. + Weight::from_parts(13_450_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 70_751 - .saturating_add(Weight::from_parts(93_977_850, 0).saturating_mul(n.into())) + // Standard Error: 59_142 + .saturating_add(Weight::from_parts(101_994_623, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `80` - // Estimated: `5487` - // Minimum execution time: 130_861_000 picoseconds. - Weight::from_parts(131_705_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `52996` + // Estimated: `109014` + // Minimum execution time: 266_450_000 picoseconds. + Weight::from_parts(274_887_000, 0) + .saturating_add(Weight::from_parts(0, 109014)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `4` // Estimated: `2767` - // Minimum execution time: 2_413_000 picoseconds. - Weight::from_parts(2_570_000, 0) + // Minimum execution time: 2_388_000 picoseconds. + Weight::from_parts(2_520_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -171,7 +190,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `39` // Estimated: `2767` // Minimum execution time: 3_782_000 picoseconds. - Weight::from_parts(3_967_000, 0) + Weight::from_parts(3_940_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_149_000 picoseconds. - Weight::from_parts(5_402_000, 0) + // Minimum execution time: 5_418_000 picoseconds. + Weight::from_parts(5_613_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105645` // Estimated: `109110` - // Minimum execution time: 207_444_000 picoseconds. - Weight::from_parts(216_987_000, 0) + // Minimum execution time: 210_814_000 picoseconds. + Weight::from_parts(217_016_000, 0) .saturating_add(Weight::from_parts(0, 109110)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65714` // Estimated: `69179` - // Minimum execution time: 124_071_000 picoseconds. - Weight::from_parts(127_720_000, 0) + // Minimum execution time: 126_881_000 picoseconds. + Weight::from_parts(131_302_000, 0) .saturating_add(Weight::from_parts(0, 69179)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs index e17d6a18e0ed0..f8a44aa4779c9 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `142` // Estimated: `1497` - // Minimum execution time: 5_273_000 picoseconds. - Weight::from_parts(5_418_000, 0) + // Minimum execution time: 5_195_000 picoseconds. + Weight::from_parts(5_568_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `148` // Estimated: `5487` - // Minimum execution time: 13_320_000 picoseconds. - Weight::from_parts(9_541_133, 0) + // Minimum execution time: 13_430_000 picoseconds. + Weight::from_parts(9_574_197, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(1_002, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(973, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `148` // Estimated: `5487` - // Minimum execution time: 11_398_000 picoseconds. - Weight::from_parts(15_643_041, 0) + // Minimum execution time: 11_564_000 picoseconds. + Weight::from_parts(15_506_334, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 172 - .saturating_add(Weight::from_parts(113_850, 0).saturating_mul(n.into())) + // Standard Error: 205 + .saturating_add(Weight::from_parts(114_494, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `330 + n * (1 ±0)` + // Estimated: `109014` + // Minimum execution time: 19_772_000 picoseconds. + Weight::from_parts(20_089_000, 0) + .saturating_add(Weight::from_parts(0, 109014)) + // Standard Error: 11 + .saturating_add(Weight::from_parts(2_427, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `183` // Estimated: `5487` - // Minimum execution time: 12_456_000 picoseconds. - Weight::from_parts(12_898_000, 0) + // Minimum execution time: 12_651_000 picoseconds. + Weight::from_parts(13_268_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 98_955 - .saturating_add(Weight::from_parts(96_236_732, 0).saturating_mul(n.into())) + // Standard Error: 55_621 + .saturating_add(Weight::from_parts(102_763_421, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105549), added: 108024, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `148` - // Estimated: `5487` - // Minimum execution time: 130_025_000 picoseconds. - Weight::from_parts(131_796_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `53063` + // Estimated: `109014` + // Minimum execution time: 252_294_000 picoseconds. + Weight::from_parts(260_540_000, 0) + .saturating_add(Weight::from_parts(0, 109014)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `142` // Estimated: `2767` - // Minimum execution time: 3_333_000 picoseconds. - Weight::from_parts(3_554_000, 0) + // Minimum execution time: 3_337_000 picoseconds. + Weight::from_parts(3_498_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `177` // Estimated: `2767` - // Minimum execution time: 4_631_000 picoseconds. - Weight::from_parts(4_844_000, 0) + // Minimum execution time: 4_674_000 picoseconds. + Weight::from_parts(4_822_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_371_000 picoseconds. - Weight::from_parts(5_597_000, 0) + // Minimum execution time: 5_045_000 picoseconds. + Weight::from_parts(5_399_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105713` // Estimated: `109178` - // Minimum execution time: 221_896_000 picoseconds. - Weight::from_parts(227_177_000, 0) + // Minimum execution time: 211_435_000 picoseconds. + Weight::from_parts(222_691_000, 0) .saturating_add(Weight::from_parts(0, 109178)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65782` // Estimated: `69247` - // Minimum execution time: 131_406_000 picoseconds. - Weight::from_parts(132_324_000, 0) + // Minimum execution time: 126_438_000 picoseconds. + Weight::from_parts(129_423_000, 0) .saturating_add(Weight::from_parts(0, 69247)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_xcmp_queue.rs index 56c443cfd725e..bed529edcea33 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `142` // Estimated: `1497` - // Minimum execution time: 5_120_000 picoseconds. - Weight::from_parts(5_379_000, 0) + // Minimum execution time: 4_975_000 picoseconds. + Weight::from_parts(5_353_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `148` // Estimated: `5487` - // Minimum execution time: 13_413_000 picoseconds. - Weight::from_parts(9_072_883, 0) + // Minimum execution time: 13_084_000 picoseconds. + Weight::from_parts(8_989_453, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(n.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_026, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `148` // Estimated: `5487` - // Minimum execution time: 11_097_000 picoseconds. - Weight::from_parts(14_667_192, 0) + // Minimum execution time: 10_913_000 picoseconds. + Weight::from_parts(14_988_541, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 286 - .saturating_add(Weight::from_parts(121_019, 0).saturating_mul(n.into())) + // Standard Error: 235 + .saturating_add(Weight::from_parts(130_851, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `330 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 19_799_000 picoseconds. + Weight::from_parts(20_095_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_584, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `183` // Estimated: `5487` - // Minimum execution time: 12_579_000 picoseconds. - Weight::from_parts(12_746_000, 0) + // Minimum execution time: 12_421_000 picoseconds. + Weight::from_parts(12_780_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 80_865 - .saturating_add(Weight::from_parts(95_971_763, 0).saturating_mul(n.into())) + // Standard Error: 84_412 + .saturating_add(Weight::from_parts(106_740_006, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `148` - // Estimated: `5487` - // Minimum execution time: 134_592_000 picoseconds. - Weight::from_parts(135_210_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `53063` + // Estimated: `108986` + // Minimum execution time: 279_435_000 picoseconds. + Weight::from_parts(285_825_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `142` // Estimated: `2767` - // Minimum execution time: 3_204_000 picoseconds. - Weight::from_parts(3_438_000, 0) + // Minimum execution time: 3_187_000 picoseconds. + Weight::from_parts(3_390_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `177` // Estimated: `2767` - // Minimum execution time: 4_521_000 picoseconds. - Weight::from_parts(4_676_000, 0) + // Minimum execution time: 4_450_000 picoseconds. + Weight::from_parts(4_688_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_152_000 picoseconds. - Weight::from_parts(5_737_000, 0) + // Minimum execution time: 5_199_000 picoseconds. + Weight::from_parts(5_368_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105713` // Estimated: `109178` - // Minimum execution time: 219_716_000 picoseconds. - Weight::from_parts(223_748_000, 0) + // Minimum execution time: 229_715_000 picoseconds. + Weight::from_parts(232_586_000, 0) .saturating_add(Weight::from_parts(0, 109178)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65782` // Estimated: `69247` - // Minimum execution time: 129_234_000 picoseconds. - Weight::from_parts(131_014_000, 0) + // Minimum execution time: 133_351_000 picoseconds. + Weight::from_parts(135_787_000, 0) .saturating_add(Weight::from_parts(0, 69247)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_xcmp_queue.rs index db54a4ce59c67..5051a8c8e96b2 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1497` - // Minimum execution time: 4_837_000 picoseconds. - Weight::from_parts(5_170_000, 0) + // Minimum execution time: 4_788_000 picoseconds. + Weight::from_parts(5_033_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 13_084_000 picoseconds. - Weight::from_parts(8_739_344, 0) + // Minimum execution time: 12_649_000 picoseconds. + Weight::from_parts(8_733_180, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(1_000, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(982, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 10_994_000 picoseconds. - Weight::from_parts(14_949_012, 0) + // Minimum execution time: 10_604_000 picoseconds. + Weight::from_parts(14_570_286, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 148 - .saturating_add(Weight::from_parts(119_649, 0).saturating_mul(n.into())) + // Standard Error: 193 + .saturating_add(Weight::from_parts(117_011, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 19_467_000 picoseconds. + Weight::from_parts(19_689_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 11 + .saturating_add(Weight::from_parts(2_365, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `117` // Estimated: `5487` - // Minimum execution time: 12_418_000 picoseconds. - Weight::from_parts(12_567_000, 0) + // Minimum execution time: 12_234_000 picoseconds. + Weight::from_parts(12_623_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 68_698 - .saturating_add(Weight::from_parts(94_530_242, 0).saturating_mul(n.into())) + // Standard Error: 62_233 + .saturating_add(Weight::from_parts(102_929_572, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `82` - // Estimated: `5487` - // Minimum execution time: 135_051_000 picoseconds. - Weight::from_parts(136_224_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `52997` + // Estimated: `108986` + // Minimum execution time: 254_750_000 picoseconds. + Weight::from_parts(262_602_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `2767` - // Minimum execution time: 3_018_000 picoseconds. - Weight::from_parts(3_160_000, 0) + // Minimum execution time: 2_920_000 picoseconds. + Weight::from_parts(3_228_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `111` // Estimated: `2767` - // Minimum execution time: 4_298_000 picoseconds. - Weight::from_parts(4_504_000, 0) + // Minimum execution time: 4_301_000 picoseconds. + Weight::from_parts(4_501_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_091_000 picoseconds. - Weight::from_parts(5_326_000, 0) + // Minimum execution time: 5_274_000 picoseconds. + Weight::from_parts(5_575_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105647` // Estimated: `109112` - // Minimum execution time: 220_697_000 picoseconds. - Weight::from_parts(228_625_000, 0) + // Minimum execution time: 212_251_000 picoseconds. + Weight::from_parts(220_677_000, 0) .saturating_add(Weight::from_parts(0, 109112)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65716` // Estimated: `69181` - // Minimum execution time: 128_465_000 picoseconds. - Weight::from_parts(130_685_000, 0) + // Minimum execution time: 125_236_000 picoseconds. + Weight::from_parts(127_502_000, 0) .saturating_add(Weight::from_parts(0, 69181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_xcmp_queue.rs index 9fca22f9e78ca..7aa9c8a0896c2 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1497` - // Minimum execution time: 4_897_000 picoseconds. - Weight::from_parts(5_245_000, 0) + // Minimum execution time: 4_864_000 picoseconds. + Weight::from_parts(5_179_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 12_793_000 picoseconds. - Weight::from_parts(8_346_709, 0) + // Minimum execution time: 12_962_000 picoseconds. + Weight::from_parts(8_522_179, 0) .saturating_add(Weight::from_parts(0, 5487)) // Standard Error: 6 - .saturating_add(Weight::from_parts(1_006, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_028, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 10_859_000 picoseconds. - Weight::from_parts(14_746_768, 0) + // Minimum execution time: 10_903_000 picoseconds. + Weight::from_parts(14_761_815, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 140 - .saturating_add(Weight::from_parts(114_347, 0).saturating_mul(n.into())) + // Standard Error: 200 + .saturating_add(Weight::from_parts(117_611, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 19_215_000 picoseconds. + Weight::from_parts(19_684_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_568, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `117` // Estimated: `5487` - // Minimum execution time: 12_393_000 picoseconds. - Weight::from_parts(12_544_000, 0) + // Minimum execution time: 12_217_000 picoseconds. + Weight::from_parts(12_477_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 64_574 - .saturating_add(Weight::from_parts(94_393_450, 0).saturating_mul(n.into())) + // Standard Error: 55_582 + .saturating_add(Weight::from_parts(106_437_894, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `82` - // Estimated: `5487` - // Minimum execution time: 129_834_000 picoseconds. - Weight::from_parts(131_193_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `52997` + // Estimated: `108986` + // Minimum execution time: 264_971_000 picoseconds. + Weight::from_parts(275_172_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `2767` - // Minimum execution time: 3_004_000 picoseconds. - Weight::from_parts(3_387_000, 0) + // Minimum execution time: 2_996_000 picoseconds. + Weight::from_parts(3_216_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `111` // Estimated: `2767` - // Minimum execution time: 4_366_000 picoseconds. - Weight::from_parts(4_522_000, 0) + // Minimum execution time: 4_320_000 picoseconds. + Weight::from_parts(4_499_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_076_000 picoseconds. - Weight::from_parts(5_281_000, 0) + // Minimum execution time: 5_044_000 picoseconds. + Weight::from_parts(5_145_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105647` // Estimated: `109112` - // Minimum execution time: 220_997_000 picoseconds. - Weight::from_parts(229_128_000, 0) + // Minimum execution time: 223_930_000 picoseconds. + Weight::from_parts(234_241_000, 0) .saturating_add(Weight::from_parts(0, 109112)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65716` // Estimated: `69181` - // Minimum execution time: 129_492_000 picoseconds. - Weight::from_parts(131_679_000, 0) + // Minimum execution time: 132_117_000 picoseconds. + Weight::from_parts(134_663_000, 0) .saturating_add(Weight::from_parts(0, 69181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_xcmp_queue.rs index b3d1aeadb2edd..32ae0f05dadba 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1497` - // Minimum execution time: 4_884_000 picoseconds. - Weight::from_parts(5_133_000, 0) + // Minimum execution time: 4_894_000 picoseconds. + Weight::from_parts(5_140_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 12_631_000 picoseconds. - Weight::from_parts(8_912_789, 0) + // Minimum execution time: 13_062_000 picoseconds. + Weight::from_parts(8_854_073, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(943, 0).saturating_mul(n.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(985, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 10_775_000 picoseconds. - Weight::from_parts(14_656_859, 0) + // Minimum execution time: 10_915_000 picoseconds. + Weight::from_parts(14_766_724, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 150 - .saturating_add(Weight::from_parts(115_219, 0).saturating_mul(n.into())) + // Standard Error: 228 + .saturating_add(Weight::from_parts(117_905, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 19_506_000 picoseconds. + Weight::from_parts(19_645_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_407, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `117` // Estimated: `5487` - // Minimum execution time: 12_029_000 picoseconds. - Weight::from_parts(12_430_000, 0) + // Minimum execution time: 12_218_000 picoseconds. + Weight::from_parts(12_586_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 71_234 - .saturating_add(Weight::from_parts(92_348_672, 0).saturating_mul(n.into())) + // Standard Error: 105_927 + .saturating_add(Weight::from_parts(101_388_985, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `82` - // Estimated: `5487` - // Minimum execution time: 130_253_000 picoseconds. - Weight::from_parts(132_148_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `52997` + // Estimated: `108986` + // Minimum execution time: 253_077_000 picoseconds. + Weight::from_parts(257_994_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `2767` - // Minimum execution time: 3_011_000 picoseconds. - Weight::from_parts(3_207_000, 0) + // Minimum execution time: 3_102_000 picoseconds. + Weight::from_parts(3_289_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `111` // Estimated: `2767` - // Minimum execution time: 4_312_000 picoseconds. - Weight::from_parts(4_561_000, 0) + // Minimum execution time: 4_386_000 picoseconds. + Weight::from_parts(4_658_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_246_000 picoseconds. - Weight::from_parts(5_385_000, 0) + // Minimum execution time: 5_154_000 picoseconds. + Weight::from_parts(5_368_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105647` // Estimated: `109112` - // Minimum execution time: 203_231_000 picoseconds. - Weight::from_parts(212_877_000, 0) + // Minimum execution time: 209_858_000 picoseconds. + Weight::from_parts(220_504_000, 0) .saturating_add(Weight::from_parts(0, 109112)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65716` // Estimated: `69181` - // Minimum execution time: 123_434_000 picoseconds. - Weight::from_parts(125_488_000, 0) + // Minimum execution time: 127_163_000 picoseconds. + Weight::from_parts(132_512_000, 0) .saturating_add(Weight::from_parts(0, 69181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_xcmp_queue.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_xcmp_queue.rs index 34c4ffc1103b4..7159ed0809bd9 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_xcmp_queue.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `341e66d5356e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `16d5a52ef0dc`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,8 +56,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1497` - // Minimum execution time: 5_118_000 picoseconds. - Weight::from_parts(5_317_000, 0) + // Minimum execution time: 4_910_000 picoseconds. + Weight::from_parts(5_170_000, 0) .saturating_add(Weight::from_parts(0, 1497)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,11 +77,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 12_843_000 picoseconds. - Weight::from_parts(9_077_837, 0) + // Minimum execution time: 12_705_000 picoseconds. + Weight::from_parts(8_172_546, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_009, 0).saturating_mul(n.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_028, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -100,11 +100,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `82` // Estimated: `5487` - // Minimum execution time: 10_809_000 picoseconds. - Weight::from_parts(14_865_726, 0) + // Minimum execution time: 10_949_000 picoseconds. + Weight::from_parts(14_462_029, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 164 - .saturating_add(Weight::from_parts(114_420, 0).saturating_mul(n.into())) + // Standard Error: 201 + .saturating_add(Weight::from_parts(119_824, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -112,6 +112,27 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 19_543_000 picoseconds. + Weight::from_parts(19_802_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_565, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -123,11 +144,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `117` // Estimated: `5487` - // Minimum execution time: 12_268_000 picoseconds. - Weight::from_parts(12_507_000, 0) + // Minimum execution time: 12_500_000 picoseconds. + Weight::from_parts(12_672_000, 0) .saturating_add(Weight::from_parts(0, 5487)) - // Standard Error: 49_300 - .saturating_add(Weight::from_parts(95_127_663, 0).saturating_mul(n.into())) + // Standard Error: 221_916 + .saturating_add(Weight::from_parts(106_306_015, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -136,21 +157,19 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `82` - // Estimated: `5487` - // Minimum execution time: 129_028_000 picoseconds. - Weight::from_parts(130_841_000, 0) - .saturating_add(Weight::from_parts(0, 5487)) + // Measured: `52997` + // Estimated: `108986` + // Minimum execution time: 266_767_000 picoseconds. + Weight::from_parts(275_163_000, 0) + .saturating_add(Weight::from_parts(0, 108986)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) @@ -158,8 +177,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `2767` - // Minimum execution time: 3_064_000 picoseconds. - Weight::from_parts(3_390_000, 0) + // Minimum execution time: 2_950_000 picoseconds. + Weight::from_parts(3_180_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +189,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `111` // Estimated: `2767` - // Minimum execution time: 4_341_000 picoseconds. - Weight::from_parts(4_593_000, 0) + // Minimum execution time: 4_530_000 picoseconds. + Weight::from_parts(4_798_000, 0) .saturating_add(Weight::from_parts(0, 2767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -180,8 +199,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_245_000 picoseconds. - Weight::from_parts(5_368_000, 0) + // Minimum execution time: 5_231_000 picoseconds. + Weight::from_parts(5_399_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -202,8 +221,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `105647` // Estimated: `109112` - // Minimum execution time: 220_348_000 picoseconds. - Weight::from_parts(225_256_000, 0) + // Minimum execution time: 227_766_000 picoseconds. + Weight::from_parts(236_600_000, 0) .saturating_add(Weight::from_parts(0, 109112)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -226,8 +245,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65716` // Estimated: `69181` - // Minimum execution time: 130_008_000 picoseconds. - Weight::from_parts(131_252_000, 0) + // Minimum execution time: 132_541_000 picoseconds. + Weight::from_parts(135_781_000, 0) .saturating_add(Weight::from_parts(0, 69181)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) diff --git a/prdoc/pr_8344.prdoc b/prdoc/pr_8344.prdoc new file mode 100644 index 0000000000000..2a3a48066d726 --- /dev/null +++ b/prdoc/pr_8344.prdoc @@ -0,0 +1,32 @@ +title: 'XCMP weight metering: account for the MQ page position' +doc: +- audience: Runtime Dev + description: |- + This PR introduces some XCMP weight metering improvements. +crates: +- name: cumulus-pallet-xcmp-queue + bump: major +- name: pallet-message-queue + bump: patch +- name: frame-support + bump: major +- name: asset-hub-rococo-runtime + bump: patch +- name: asset-hub-westend-runtime + bump: patch +- name: bridge-hub-rococo-runtime + bump: patch +- name: bridge-hub-westend-runtime + bump: patch +- name: collectives-westend-runtime + bump: patch +- name: coretime-rococo-runtime + bump: patch +- name: coretime-westend-runtime + bump: patch +- name: people-rococo-runtime + bump: patch +- name: people-westend-runtime + bump: patch +- name: pallet-staking-async-parachain-runtime + bump: patch diff --git a/substrate/frame/message-queue/src/lib.rs b/substrate/frame/message-queue/src/lib.rs index d8e6f673a4afb..ede4d825e937c 100644 --- a/substrate/frame/message-queue/src/lib.rs +++ b/substrate/frame/message-queue/src/lib.rs @@ -212,7 +212,7 @@ use frame_support::{ defensive, pallet_prelude::*, traits::{ - BatchFootprint, Defensive, DefensiveSaturating, DefensiveTruncateFrom, EnqueueMessage, + BatchesFootprints, Defensive, DefensiveSaturating, DefensiveTruncateFrom, EnqueueMessage, ExecuteOverweightError, Footprint, ProcessMessage, ProcessMessageError, QueueFootprint, QueueFootprintQuery, QueuePausedQuery, ServiceQueues, }, @@ -1830,10 +1830,10 @@ impl QueueFootprintQuery> for Pallet { origin: MessageOriginOf, msgs: impl Iterator>, total_pages_limit: u32, - ) -> Vec { - let mut batches_footprints = vec![]; + ) -> BatchesFootprints { + let mut batches_footprints = BatchesFootprints::default(); - let mut new_pages_count = 0; + let mut new_page = false; let mut total_pages_count = 0; let mut current_page_pos: usize = T::HeapSize::get().into() as usize; @@ -1842,31 +1842,27 @@ impl QueueFootprintQuery> for Pallet { total_pages_count = book.end - book.begin; if let Some(page) = Pages::::get(origin, book.end - 1) { current_page_pos = page.heap_pos(); + batches_footprints.first_page_pos = current_page_pos; } } - let mut msgs = msgs.enumerate().peekable(); - let mut total_msgs_size = 0; - while let Some((idx, msg)) = msgs.peek() { + let mut msgs = msgs.peekable(); + while let Some(msg) = msgs.peek() { if total_pages_count > total_pages_limit { return batches_footprints; } match Page::::can_append_message_at(current_page_pos, msg.len()) { Ok(new_pos) => { - total_msgs_size += msg.len(); current_page_pos = new_pos; - batches_footprints.push(BatchFootprint { - msgs_count: idx + 1, - size_in_bytes: total_msgs_size, - new_pages_count, - }); + batches_footprints.push(msg, new_page); + new_page = false; msgs.next(); }, Err(_) => { // Would not fit into the current page. // We start a new one and try again in the next iteration. - new_pages_count += 1; + new_page = true; total_pages_count += 1; current_page_pos = 0; }, diff --git a/substrate/frame/message-queue/src/tests.rs b/substrate/frame/message-queue/src/tests.rs index f2247187e232b..4f7d9997f7ae4 100644 --- a/substrate/frame/message-queue/src/tests.rs +++ b/substrate/frame/message-queue/src/tests.rs @@ -21,7 +21,9 @@ use crate::{mock::*, *}; -use frame_support::{assert_noop, assert_ok, assert_storage_noop, StorageNoopGuard}; +use frame_support::{ + assert_noop, assert_ok, assert_storage_noop, traits::BatchFootprint, StorageNoopGuard, +}; use rand::{rngs::StdRng, Rng, SeedableRng}; use sp_crypto_hashing::blake2_256; @@ -2144,6 +2146,7 @@ fn check_get_batches_footprints( origin: MessageOrigin, sizes: &[u32], total_pages_limit: u32, + expected_first_page_pos: usize, expected_new_pages_counts: Vec, ) { let mut msgs = vec![]; @@ -2158,7 +2161,8 @@ fn check_get_batches_footprints( msgs.iter().map(|msg| msg.as_bounded_slice()), total_pages_limit, ); - assert_eq!(batches_footprints.len(), expected_new_pages_counts.len()); + assert_eq!(batches_footprints.first_page_pos, expected_first_page_pos); + assert_eq!(batches_footprints.footprints.len(), expected_new_pages_counts.len()); let mut total_size = 0; let mut expected_batches_footprint = vec![]; @@ -2170,7 +2174,7 @@ fn check_get_batches_footprints( new_pages_count: *expected_new_pages_count, }); } - assert_eq!(batches_footprints, expected_batches_footprint); + assert_eq!(batches_footprints.footprints, expected_batches_footprint); } #[test] @@ -2182,15 +2186,16 @@ fn get_batches_footprints_works() { build_and_execute::(|| { // Perform some checks with an empty queue - check_get_batches_footprints(Here, &[max_message_len], 0, vec![]); - check_get_batches_footprints(Here, &[max_message_len], 1, vec![1]); + check_get_batches_footprints(Here, &[max_message_len], 0, 0, vec![]); + check_get_batches_footprints(Here, &[max_message_len], 1, 0, vec![1]); - check_get_batches_footprints(Here, &[max_message_len, 1], 1, vec![1]); - check_get_batches_footprints(Here, &[max_message_len, 1], 2, vec![1, 2]); + check_get_batches_footprints(Here, &[max_message_len, 1], 1, 0, vec![1]); + check_get_batches_footprints(Here, &[max_message_len, 1], 2, 0, vec![1, 2]); check_get_batches_footprints( Here, &[max_message_len - 2 * header_size, 1, 1], 1, + 0, vec![1, 1], ); @@ -2198,19 +2203,20 @@ fn get_batches_footprints_works() { MessageQueue::enqueue_message(msg("A".repeat(max_message_len as usize).as_str()), Here); MessageQueue::enqueue_message(msg(""), Here); // Now, let's perform some more checks - check_get_batches_footprints(Here, &[max_message_len - header_size], 1, vec![]); - check_get_batches_footprints(Here, &[max_message_len - header_size], 2, vec![0]); + check_get_batches_footprints(Here, &[max_message_len - header_size], 1, 5, vec![]); + check_get_batches_footprints(Here, &[max_message_len - header_size], 2, 5, vec![0]); - check_get_batches_footprints(Here, &[max_message_len - header_size, 1], 2, vec![0]); - check_get_batches_footprints(Here, &[max_message_len - header_size, 1], 3, vec![0, 1]); + check_get_batches_footprints(Here, &[max_message_len - header_size, 1], 2, 5, vec![0]); + check_get_batches_footprints(Here, &[max_message_len - header_size, 1], 3, 5, vec![0, 1]); check_get_batches_footprints( Here, &[max_message_len - header_size, max_message_len - 2 * header_size, 1, 1], 3, + 5, vec![0, 1, 1], ); // Check that we can append messages to a different origin - check_get_batches_footprints(There, &[max_message_len], 1, vec![1]); + check_get_batches_footprints(There, &[max_message_len], 1, 0, vec![1]); }); } diff --git a/substrate/frame/staking-async/runtimes/parachain/src/weights/cumulus_pallet_xcmp_queue.rs b/substrate/frame/staking-async/runtimes/parachain/src/weights/cumulus_pallet_xcmp_queue.rs index 85980091ea428..60543220d68c1 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/weights/cumulus_pallet_xcmp_queue.rs @@ -106,6 +106,26 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 105457]`. + fn enqueue_empty_xcmp_message_at(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + n * (1 ±0)` + // Estimated: `108986` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_015_940, 108986) + // Standard Error: 32 + .saturating_add(Weight::from_parts(911, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: Some(12), added: 507, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) @@ -137,12 +157,12 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: - // Measured: `151` - // Estimated: `5487` - // Minimum execution time: 118_730_000 picoseconds. - Weight::from_parts(123_480_000, 5487) + // Measured: `53067` + // Estimated: `108986` + // Minimum execution time: 139_000_000 picoseconds. + Weight::from_parts(148_000_000, 108986) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) diff --git a/substrate/frame/support/src/traits.rs b/substrate/frame/support/src/traits.rs index 557a4b17d61d3..18b8a391a14fc 100644 --- a/substrate/frame/support/src/traits.rs +++ b/substrate/frame/support/src/traits.rs @@ -118,9 +118,9 @@ pub use preimages::{Bounded, BoundedInline, FetchResult, QueryPreimage, StorePre mod messages; pub use messages::{ - BatchFootprint, EnqueueMessage, EnqueueWithOrigin, ExecuteOverweightError, HandleMessage, - NoopServiceQueues, ProcessMessage, ProcessMessageError, QueueFootprint, QueueFootprintQuery, - QueuePausedQuery, ServiceQueues, TransformOrigin, + BatchFootprint, BatchesFootprints, EnqueueMessage, EnqueueWithOrigin, ExecuteOverweightError, + HandleMessage, NoopServiceQueues, ProcessMessage, ProcessMessageError, QueueFootprint, + QueueFootprintQuery, QueuePausedQuery, ServiceQueues, TransformOrigin, }; mod safe_mode; diff --git a/substrate/frame/support/src/traits/messages.rs b/substrate/frame/support/src/traits/messages.rs index 0370877510b46..0a5c70f8f0fa5 100644 --- a/substrate/frame/support/src/traits/messages.rs +++ b/substrate/frame/support/src/traits/messages.rs @@ -18,9 +18,11 @@ //! Traits for managing message queuing and handling. use super::storage::Footprint; -use alloc::{vec, vec::Vec}; +use crate::defensive; + +use alloc::vec::Vec; use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen}; -use core::{fmt::Debug, marker::PhantomData}; +use core::{cmp::Ordering, fmt::Debug, marker::PhantomData}; use scale_info::TypeInfo; use sp_core::{ConstU32, Get, TypedGet}; use sp_runtime::{traits::Convert, BoundedSlice, RuntimeDebug}; @@ -164,7 +166,7 @@ pub struct QueueFootprint { } /// The resource footprint of a batch of messages. -#[derive(Default, Copy, Clone, Eq, PartialEq, RuntimeDebug)] +#[derive(Default, Copy, Clone, PartialEq, RuntimeDebug)] pub struct BatchFootprint { /// The number of messages in the batch. pub msgs_count: usize, @@ -174,6 +176,69 @@ pub struct BatchFootprint { pub new_pages_count: u32, } +/// The resource footprints of continuous subsets of messages. +/// +/// For a set of messages `xcms[0..n]`, each `footprints[i]` contains the footprint +/// of the batch `xcms[0..i]`, so as `i` increases `footprints[i]` contains the footprint +/// of a bigger batch. +#[derive(Default, RuntimeDebug)] +pub struct BatchesFootprints { + /// The position in the first available MQ page where the batch will start being appended. + /// + /// The messages in the batch will be enqueued to the message queue. Since the message queue is + /// organized in pages, the messages may be enqueued across multiple contiguous pages. + /// The position where we start appending messages to the first available MQ page is of + /// particular importance since it impacts the performance of the enqueuing operation. + /// That's because the first page has to be decoded first. This is not needed for the following + /// pages. + pub first_page_pos: usize, + pub footprints: Vec, +} + +impl BatchesFootprints { + /// Appends a batch footprint to the back of the collection. + /// + /// The new footprint represents a batch that includes all the messages contained by the + /// previous batches plus the provided `msg`. If `new_page` is true, we will consider that + /// the provided `msg` is appended to a new message queue page. Otherwise, we consider + /// that it is appended to the current page. + pub fn push(&mut self, msg: &[u8], new_page: bool) { + let previous_footprint = + self.footprints.last().map(|footprint| *footprint).unwrap_or_default(); + + let mut new_pages_count = previous_footprint.new_pages_count; + if new_page { + new_pages_count = new_pages_count.saturating_add(1); + } + self.footprints.push(BatchFootprint { + msgs_count: previous_footprint.msgs_count.saturating_add(1), + size_in_bytes: previous_footprint.size_in_bytes.saturating_add(msg.len()), + new_pages_count, + }); + } + + /// Gets the biggest batch for which the comparator function returns `Ordering::Less`. + pub fn search_best_by(&self, f: F) -> &BatchFootprint + where + F: FnMut(&BatchFootprint) -> Ordering, + { + // Since the batches are sorted by size, we can use binary search. + let maybe_best_idx = match self.footprints.binary_search_by(f) { + Ok(last_ok_idx) => Some(last_ok_idx), + Err(first_err_idx) => first_err_idx.checked_sub(1), + }; + if let Some(best_idx) = maybe_best_idx { + match self.footprints.get(best_idx) { + Some(best_footprint) => return best_footprint, + None => { + defensive!("Invalid best_batch_idx: {}", best_idx); + }, + } + } + &BatchFootprint { msgs_count: 0, size_in_bytes: 0, new_pages_count: 0 } + } +} + /// Provides information on queue footprint. pub trait QueueFootprintQuery { /// The maximal length any enqueued message may have. @@ -214,7 +279,7 @@ pub trait QueueFootprintQuery { origin: Origin, msgs: impl Iterator>, total_pages_limit: u32, - ) -> Vec; + ) -> BatchesFootprints; } impl QueueFootprintQuery for () { @@ -228,8 +293,8 @@ impl QueueFootprintQuery for () { _origin: Origin, _msgs: impl Iterator>, _total_pages_limit: u32, - ) -> Vec { - vec![] + ) -> BatchesFootprints { + BatchesFootprints::default() } } @@ -269,7 +334,7 @@ impl, O: MaxEncodedLen, N: MaxEncodedLen, C: Convert>, total_pages_limit: u32, - ) -> Vec { + ) -> BatchesFootprints { E::get_batches_footprints(C::convert(origin), msgs, total_pages_limit) } }