8000 ADD: datalog weights by brainwhat · Pull Request #375 · airalab/robonomics · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ADD: datalog weights #375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account relate 8000 d emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frame/datalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use weights::WeightInfo;

#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
mod weights;
pub mod weights;

#[frame_support::pallet]
#[allow(clippy::module_inception)]
Expand Down Expand Up @@ -126,7 +126,7 @@ pub mod pallet {
}

/// Clear account datalog.
#[pallet::weight(T::WeightInfo::erase(T::WindowSize::get()))]
#[pallet::weight(T::WeightInfo::erase())]
#[pallet::call_index(1)]
pub fn erase(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
let sender = ensure_signed(origin)?;
Expand All @@ -142,7 +142,7 @@ pub mod pallet {
}

Self::deposit_event(Event::Erased(sender));
Ok(Some(T::WeightInfo::erase(count)).into())
Ok(().into())
}
}

Expand Down
96 changes: 68 additions & 28 deletions frame/datalog/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,73 @@
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2018-2024 Robonomics Network <research@robonomics.network>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
use frame_support::weights::Weight;
//! Autogenerated weights for `robonomics_datalog`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2025-03-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `MacBookAir.sknt.ru`, CPU: `<UNKNOWN>`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024

// Executed Command:
// ./target/release/robonomics
// benchmark
// pallet
// --chain
// dev
// --pallet
// robonomics_datalog
// --extrinsic
// *
// --steps
// 20
// --repeat
// 10
// --output
// ./frame/datalog/src/weights.rs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]

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

/// Weight functions.
pub trait WeightInfo {
fn record() -> Weight;
fn erase(win: u64) -> Weight;
fn record() -> Weight;
fn erase() -> Weight;
}

impl WeightInfo for () {
fn record() -> Weight {
Default::default()
}

fn erase(_win: u64) -> Weight {
Default::default()
}
/// Weight functions for `robonomics_datalog`.
pub struct RobonomicsWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for RobonomicsWeight<T> {
/// Storage: `Timestamp::Now` (r:1 w:0)
/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Datalog::DatalogIndex` (r:1 w:1)
/// Proof: `Datalog::DatalogIndex` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`)
/// Storage: `Datalog::DatalogItem` (r:0 w:1)
/// Proof: `Datalog::DatalogItem` (`max_values`: None, `max_size`: Some(570), added: 3045, mode: `MaxEncodedLen`)
fn record() -> Weight {
// Proof Size summary in bytes:
// Measured: `148`
// Estimated: `3521`
// Minimum execution time: 15_000_000 picoseconds.
Weight::from_parts(16_000_000, 0)
.saturating_add(Weight::from_parts(0, 3521))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Datalog::DatalogIndex` (r:1 w:1)
/// Proof: `Datalog::DatalogIndex` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`)
/// Storage: `Datalog::DatalogItem` (r:0 w:127)
/// Proof: `Datalog::DatalogItem` (`max_values`: None, `max_size`: Some(570), added: 3045, mode: `MaxEncodedLen`)
fn erase() -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3521`
// Minimum execution time: 168_000_000 picoseconds.
Weight::from_parts(172_000_000, 0)
.saturating_add(Weight::from_parts(0, 3521))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(128))
}
}
2 changes: 1 addition & 1 deletion runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ impl pallet_robonomics_datalog::Config for Runtime {
type Record = BoundedVec<u8, MaximumMessageSize>;
type RuntimeEvent = RuntimeEvent;
type WindowSize = WindowSize;
type WeightInfo = ();
type WeightInfo = pallet_robonomics_datalog::weights::RobonomicsWeight<Runtime>;
}

impl pallet_robonomics_launch::Config for Runtime {
Expand Down
0