Skip to content

Commit

Permalink
Fix V2 PoV benchmarking (paritytech#13485)
Browse files Browse the repository at this point in the history
* Bump default 'additional_trie_layers' to two

The default here only works for extremely small runtimes, which have
no more than 16 storage prefices. This is changed to a "sane" default
of 2, which is save for runtimes with up to 4096 storage prefices (eg StorageValue).

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Update tests and test weights

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Fix PoV weights

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_message_queue

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_glutton

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_glutton

* Fix sanity check

>0 would also do as a check, but let's try this.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: command-bot <>
  • Loading branch information
ggwpez authored and ukint-vs committed Apr 10, 2023
1 parent b906470 commit 17df916
Show file tree
Hide file tree
Showing 8 changed files with 576 additions and 477 deletions.
139 changes: 77 additions & 62 deletions frame/balances/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@
//! Autogenerated weights for pallet_balances
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-01-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-02-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024

// Executed Command:
// ./target/production/substrate
// target/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_balances
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/balances/src/weights.rs
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet_balances
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/balances/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs

#![cfg_attr(rustfmt, rustfmt_skip)]
Expand Down Expand Up @@ -64,76 +65,83 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `1723`
// Estimated: `2603`
// Minimum execution time: 47_557 nanoseconds.
Weight::from_parts(48_314_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 37_815 nanoseconds.
Weight::from_ref_time(38_109_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `1607`
// Estimated: `2603`
// Minimum execution time: 36_372 nanoseconds.
Weight::from_parts(37_432_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 28_184 nanoseconds.
Weight::from_ref_time(49_250_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn set_balance_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `1757`
// Estimated: `2603`
// Minimum execution time: 26_671 nanoseconds.
Weight::from_parts(28_287_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 17_474 nanoseconds.
Weight::from_ref_time(17_777_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn set_balance_killing() -> Weight {
// Proof Size summary in bytes:
// Measured: `1757`
// Estimated: `2603`
// Minimum execution time: 30_122 nanoseconds.
Weight::from_parts(30_615_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 20_962 nanoseconds.
Weight::from_ref_time(21_419_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `1719`
// Estimated: `5206`
// Minimum execution time: 47_891 nanoseconds.
Weight::from_parts(48_496_000, 5206)
// Measured: `135`
// Estimated: `6196`
// Minimum execution time: 39_713 nanoseconds.
Weight::from_ref_time(40_360_000)
.saturating_add(Weight::from_proof_size(6196))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `1607`
// Estimated: `2603`
// Minimum execution time: 42_470 nanoseconds.
Weight::from_parts(42_950_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 34_878 nanoseconds.
Weight::from_ref_time(35_121_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn force_unreserve() -> Weight {
// Proof Size summary in bytes:
// Measured: `1641`
// Estimated: `2603`
// Minimum execution time: 23_230 nanoseconds.
Weight::from_parts(23_951_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 16_790 nanoseconds.
Weight::from_ref_time(17_029_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -145,76 +153,83 @@ impl WeightInfo for () {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `1723`
// Estimated: `2603`
// Minimum execution time: 47_557 nanoseconds.
Weight::from_parts(48_314_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 37_815 nanoseconds.
Weight::from_ref_time(38_109_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `1607`
// Estimated: `2603`
// Minimum execution time: 36_372 nanoseconds.
Weight::from_parts(37_432_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 28_184 nanoseconds.
Weight::from_ref_time(49_250_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn set_balance_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `1757`
// Estimated: `2603`
// Minimum execution time: 26_671 nanoseconds.
Weight::from_parts(28_287_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 17_474 nanoseconds.
Weight::from_ref_time(17_777_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn set_balance_killing() -> Weight {
// Proof Size summary in bytes:
// Measured: `1757`
// Estimated: `2603`
// Minimum execution time: 30_122 nanoseconds.
Weight::from_parts(30_615_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 20_962 nanoseconds.
Weight::from_ref_time(21_419_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `1719`
// Estimated: `5206`
// Minimum execution time: 47_891 nanoseconds.
Weight::from_parts(48_496_000, 5206)
// Measured: `135`
// Estimated: `6196`
// Minimum execution time: 39_713 nanoseconds.
Weight::from_ref_time(40_360_000)
.saturating_add(Weight::from_proof_size(6196))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn transfer_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `1607`
// Estimated: `2603`
// Minimum execution time: 42_470 nanoseconds.
Weight::from_parts(42_950_000, 2603)
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 34_878 nanoseconds.
Weight::from_ref_time(35_121_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn force_unreserve() -> Weight {
// Proof Size summary in bytes:
// Measured: `1641`
// Estimated: `2603`
// Minimum execution time: 23_230 nanoseconds.
Weight::from_parts(23_951_000, 2603)
// Measured: `206`
// Estimated: `3593`
// Minimum execution time: 16_790 nanoseconds.
Weight::from_ref_time(17_029_000)
.saturating_add(Weight::from_proof_size(3593))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand Down
11 changes: 11 additions & 0 deletions frame/benchmarking/pov/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ frame_benchmarking::benchmarks! {
assert_eq!(Value::<T>::get(), Some(123));
}

#[pov_mode = MaxEncodedLen {
Pov::Value2: Ignored
}]
storage_single_value_ignored_some_read {
Value::<T>::put(123);
Value2::<T>::put(123);
}: {
assert_eq!(Value::<T>::get(), Some(123));
assert_eq!(Value2::<T>::get(), Some(123));
}

storage_single_value_read_twice {
Value::<T>::put(123);
}: {
Expand Down
Loading

0 comments on commit 17df916

Please sign in to comment.