mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Add benchmark tests for pallet bags list (#10593)
* Add benchmark tests for pallet bags list * Make sure to set active balance for new ledgers * fmt * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_bags_list --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/bags-list/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -175,3 +175,9 @@ frame_benchmarking::benchmarks! {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
frame_benchmarking::impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
crate::mock::ExtBuilder::default().skip_genesis_ids().build(),
|
||||
crate::mock::Runtime
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,7 +18,7 @@
|
||||
//! Autogenerated weights for pallet_bags_list
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2021-11-18, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2022-01-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
@@ -57,7 +57,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList ListNodes (r:4 w:4)
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
fn rebag_non_terminal() -> Weight {
|
||||
(70_481_000 as Weight)
|
||||
(62_060_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
@@ -66,7 +66,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList ListNodes (r:3 w:3)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn rebag_terminal() -> Weight {
|
||||
(68_642_000 as Weight)
|
||||
(60_585_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
@@ -76,7 +76,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
fn put_in_front_of() -> Weight {
|
||||
(82_341_000 as Weight)
|
||||
(69_779_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(10 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
@@ -89,7 +89,7 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList ListNodes (r:4 w:4)
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
fn rebag_non_terminal() -> Weight {
|
||||
(70_481_000 as Weight)
|
||||
(62_060_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
@@ -98,7 +98,7 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList ListNodes (r:3 w:3)
|
||||
// Storage: BagsList ListBags (r:2 w:2)
|
||||
fn rebag_terminal() -> Weight {
|
||||
(68_642_000 as Weight)
|
||||
(60_585_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
@@ -108,7 +108,7 @@ impl WeightInfo for () {
|
||||
// Storage: BagsList CounterForListNodes (r:1 w:1)
|
||||
// Storage: BagsList ListBags (r:1 w:1)
|
||||
fn put_in_front_of() -> Weight {
|
||||
(82_341_000 as Weight)
|
||||
(69_779_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
|
||||
@@ -1245,13 +1245,12 @@ impl<T: Config> VoteWeightProvider<T::AccountId> for Pallet<T> {
|
||||
// this will clearly results in an inconsistent state, but it should not matter for a
|
||||
// benchmark.
|
||||
let active: BalanceOf<T> = weight.try_into().map_err(|_| ()).unwrap();
|
||||
let ledger = match Self::ledger(who) {
|
||||
let mut ledger = match Self::ledger(who) {
|
||||
None => StakingLedger::default_from(who.clone()),
|
||||
Some(mut l) => {
|
||||
l.active = active;
|
||||
l
|
||||
},
|
||||
Some(l) => l,
|
||||
};
|
||||
ledger.active = active;
|
||||
|
||||
<Ledger<T>>::insert(who, ledger);
|
||||
<Bonded<T>>::insert(who, who);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user