Skip to content

Commit

Permalink
benchmarks: optimize trie layer (#2128)
Browse files Browse the repository at this point in the history
# Goal
The goal of this PR is to optimize benchmark weights by isolating the
**stateful-storage** to have a higher value for `additional-trie-layers`
due to using of child trees instead of applying it to all pallets.

Related to #2093 

# Checklist
- [x] Benchmarks added?
- [x] Spec version incremented?

---------

Co-authored-by: aramikm <aramikm@users.noreply.github.com>
  • Loading branch information
aramikm and aramikm authored Aug 16, 2024
1 parent 05e8acd commit 7b8c585
Show file tree
Hide file tree
Showing 24 changed files with 1,135 additions and 1,122 deletions.
70 changes: 35 additions & 35 deletions pallets/capacity/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! Autogenerated weights for `pallet_capacity`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-12, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-15, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-173-11-249`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! HOSTNAME: `ip-10-173-11-47`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`

// Executed Command:
Expand All @@ -17,11 +17,11 @@
// --chain=frequency-bench
// --heap-pages=4096
// --wasm-execution=compiled
// --additional-trie-layers=5
// --steps=20
// --repeat=10
// --output=./scripts/../pallets/capacity/src/weights.rs
// --template=./scripts/../.maintain/frame-weight-template.hbs
// --additional-trie-layers=3

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand Down Expand Up @@ -60,9 +60,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn stake() -> Weight {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6249`
// Minimum execution time: 36_441_000 picoseconds.
Weight::from_parts(37_859_000, 6249)
// Estimated: `5259`
// Minimum execution time: 37_829_000 picoseconds.
Weight::from_parts(38_703_000, 5259)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -77,9 +77,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn withdraw_unstaked() -> Weight {
// Proof Size summary in bytes:
// Measured: `285`
// Estimated: `6249`
// Minimum execution time: 24_870_000 picoseconds.
Weight::from_parts(26_034_000, 6249)
// Estimated: `5259`
// Minimum execution time: 25_467_000 picoseconds.
Weight::from_parts(26_355_000, 5259)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
Expand All @@ -90,9 +90,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn on_initialize() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `2974`
// Minimum execution time: 2_182_000 picoseconds.
Weight::from_parts(2_360_000, 2974)
// Estimated: `1984`
// Minimum execution time: 2_198_000 picoseconds.
Weight::from_parts(2_311_000, 1984)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -107,9 +107,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn unstake() -> Weight {
// Proof Size summary in bytes:
// Measured: `271`
// Estimated: `5071`
// Minimum execution time: 24_364_000 picoseconds.
Weight::from_parts(24_930_000, 5071)
// Estimated: `4081`
// Minimum execution time: 25_269_000 picoseconds.
Weight::from_parts(26_226_000, 4081)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -119,8 +119,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_045_000 picoseconds.
Weight::from_parts(4_337_000, 0)
// Minimum execution time: 4_325_000 picoseconds.
Weight::from_parts(7_213_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
Expand All @@ -144,9 +144,9 @@ impl WeightInfo for () {
fn stake() -> Weight {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6249`
// Minimum execution time: 36_441_000 picoseconds.
Weight::from_parts(37_859_000, 6249)
// Estimated: `5259`
// Minimum execution time: 37_829_000 picoseconds.
Weight::from_parts(38_703_000, 5259)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -161,9 +161,9 @@ impl WeightInfo for () {
fn withdraw_unstaked() -> Weight {
// Proof Size summary in bytes:
// Measured: `285`
// Estimated: `6249`
// Minimum execution time: 24_870_000 picoseconds.
Weight::from_parts(26_034_000, 6249)
// Estimated: `5259`
// Minimum execution time: 25_467_000 picoseconds.
Weight::from_parts(26_355_000, 5259)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
Expand All @@ -174,9 +174,9 @@ impl WeightInfo for () {
fn on_initialize() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `2974`
// Minimum execution time: 2_182_000 picoseconds.
Weight::from_parts(2_360_000, 2974)
// Estimated: `1984`
// Minimum execution time: 2_198_000 picoseconds.
Weight::from_parts(2_311_000, 1984)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand All @@ -191,9 +191,9 @@ impl WeightInfo for () {
fn unstake() -> Weight {
// Proof Size summary in bytes:
// Measured: `271`
// Estimated: `5071`
// Minimum execution time: 24_364_000 picoseconds.
Weight::from_parts(24_930_000, 5071)
// Estimated: `4081`
// Minimum execution time: 25_269_000 picoseconds.
Weight::from_parts(26_226_000, 4081)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -203,8 +203,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_045_000 picoseconds.
Weight::from_parts(4_337_000, 0)
// Minimum execution time: 4_325_000 picoseconds.
Weight::from_parts(7_213_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ mod tests {
.max_extrinsic
.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
.proof_size()
> 6249
> 5259
);
}
#[test]
Expand All @@ -252,7 +252,7 @@ mod tests {
.max_extrinsic
.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
.proof_size()
> 6249
> 5259
);
}
#[test]
Expand All @@ -264,7 +264,7 @@ mod tests {
.max_extrinsic
.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
.proof_size()
> 2974
> 1984
);
}
#[test]
Expand All @@ -276,7 +276,7 @@ mod tests {
.max_extrinsic
.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
.proof_size()
> 5071
> 4081
);
}
}
30 changes: 15 additions & 15 deletions pallets/frequency-tx-payment/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! Autogenerated weights for `pallet_frequency_tx_payment`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-12, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-15, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-173-11-249`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! HOSTNAME: `ip-10-173-11-47`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`

// Executed Command:
Expand All @@ -17,11 +17,11 @@
// --chain=frequency-bench
// --heap-pages=4096
// --wasm-execution=compiled
// --additional-trie-layers=5
// --steps=20
// --repeat=10
// --output=./scripts/../pallets/frequency-tx-payment/src/weights.rs
// --template=./scripts/../.maintain/frame-weight-template.hbs
// --additional-trie-layers=3

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -44,18 +44,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_067_000 picoseconds.
Weight::from_parts(3_408_000, 0)
// Minimum execution time: 3_192_000 picoseconds.
Weight::from_parts(3_333_000, 0)
}
/// The range of component `n` is `[0, 10]`.
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_207_000 picoseconds.
Weight::from_parts(6_052_741, 0)
// Standard Error: 12_048
.saturating_add(Weight::from_parts(3_013_135, 0).saturating_mul(n.into()))
// Minimum execution time: 5_242_000 picoseconds.
Weight::from_parts(6_274_375, 0)
// Standard Error: 11_416
.saturating_add(Weight::from_parts(3_172_765, 0).saturating_mul(n.into()))
}
}

Expand All @@ -65,18 +65,18 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_067_000 picoseconds.
Weight::from_parts(3_408_000, 0)
// Minimum execution time: 3_192_000 picoseconds.
Weight::from_parts(3_333_000, 0)
}
/// The range of component `n` is `[0, 10]`.
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_207_000 picoseconds.
Weight::from_parts(6_052_741, 0)
// Standard Error: 12_048
.saturating_add(Weight::from_parts(3_013_135, 0).saturating_mul(n.into()))
// Minimum execution time: 5_242_000 picoseconds.
Weight::from_parts(6_274_375, 0)
// Standard Error: 11_416
.saturating_add(Weight::from_parts(3_172_765, 0).saturating_mul(n.into()))
}
}

Expand Down
Loading

0 comments on commit 7b8c585

Please sign in to comment.