polkadot_runtime_constants/weights/
paritydb_weights.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
19//! DATE: 2022-03-30 (Y/M/D)
20//!
21//! DATABASE: `ParityDb`, RUNTIME: `Polkadot`
22//! BLOCK-NUM: `BlockId::Number(9653477)`
23//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
24//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: `0`
25//! WEIGHT-PATH: `runtime/polkadot/constants/src/weights/`
26//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`
27
28// Executed Command:
29//   ./target/production/polkadot
30//   benchmark-storage
31//   --db=paritydb
32//   --state-version=0
33//   --mul=1.1
34//   --weight-path=runtime/polkadot/constants/src/weights/
35
36/// Storage DB weights for the `Polkadot` runtime and `ParityDb`.
37pub mod constants {
38	use frame_support::{
39		parameter_types,
40		weights::{constants, RuntimeDbWeight},
41	};
42
43	parameter_types! {
44		/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
45		/// are available for brave runtime engineers who may want to try this out as default.
46		pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
47			/// Time to read one storage item.
48			/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
49			///
50			/// Stats [NS]:
51			///   Min, Max: 4_611, 13_478_005
52			///   Average:  10_750
53			///   Median:   10_655
54			///   Std-Dev:  12214.49
55			///
56			/// Percentiles [NS]:
57			///   99th: 14_451
58			///   95th: 12_588
59			///   75th: 11_200
60			read: 11_826 * constants::WEIGHT_REF_TIME_PER_NANOS,
61
62			/// Time to write one storage item.
63			/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
64			///
65			/// Stats [NS]:
66			///   Min, Max: 8_023, 47_367_740
67			///   Average:  34_592
68			///   Median:   32_703
69			///   Std-Dev:  49417.24
70			///
71			/// Percentiles [NS]:
72			///   99th: 69_379
73			///   95th: 47_168
74			///   75th: 35_252
75			write: 38_052 * constants::WEIGHT_REF_TIME_PER_NANOS,
76		};
77	}
78
79	#[cfg(test)]
80	mod test_db_weights {
81		use super::constants::ParityDbWeight as W;
82		use frame_support::weights::constants;
83
84		/// Checks that all weights exist and have sane values.
85		// NOTE: If this test fails but you are sure that the generated values are fine,
86		// you can delete it.
87		#[test]
88		fn bound() {
89			// At least 1 µs.
90			assert!(
91				W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
92				"Read weight should be at least 1 µs."
93			);
94			assert!(
95				W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
96				"Write weight should be at least 1 µs."
97			);
98			// At most 1 ms.
99			assert!(
100				W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
101				"Read weight should be at most 1 ms."
102			);
103			assert!(
104				W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
105				"Write weight should be at most 1 ms."
106			);
107		}
108	}
109}