This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Commit 9df9448 1 parent c1103fd commit 9df9448 Copy full SHA for 9df9448
File tree 4 files changed +52
-4
lines changed
utils/frame/benchmarking-cli/src
4 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ pub struct BlockCmd {
67
67
#[ allow( missing_docs) ]
68
68
#[ clap( flatten) ]
69
69
pub params : BenchmarkParams ,
70
+
71
+ /// Enable the Trie cache.
72
+ ///
73
+ /// This should only be used for performance analysis and not for final results.
74
+ #[ clap( long) ]
75
+ pub enable_trie_cache : bool ,
70
76
}
71
77
72
78
impl BlockCmd {
@@ -98,4 +104,12 @@ impl CliConfiguration for BlockCmd {
98
104
fn import_params ( & self ) -> Option < & ImportParams > {
99
105
Some ( & self . import_params )
100
106
}
107
+
108
+ fn trie_cache_maximum_size ( & self ) -> Result < Option < usize > > {
109
+ if self . enable_trie_cache {
110
+ Ok ( self . import_params ( ) . map ( |x| x. trie_cache_maximum_size ( ) ) . unwrap_or_default ( ) )
111
+ } else {
112
+ Ok ( None )
113
+ }
114
+ }
101
115
}
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ pub struct ExtrinsicParams {
72
72
/// Extrinsic to benchmark.
73
73
#[ clap( long, value_name = "EXTRINSIC" , required_unless_present = "list" ) ]
74
74
pub extrinsic : Option < String > ,
75
+
76
+ /// Enable the Trie cache.
77
+ ///
78
+ /// This should only be used for performance analysis and not for final results.
79
+ #[ clap( long) ]
80
+ pub enable_trie_cache : bool ,
75
81
}
76
82
77
83
impl ExtrinsicCmd {
@@ -132,4 +138,12 @@ impl CliConfiguration for ExtrinsicCmd {
132
138
fn import_params ( & self ) -> Option < & ImportParams > {
133
139
Some ( & self . import_params )
134
140
}
141
+
142
+ fn trie_cache_maximum_size ( & self ) -> Result < Option < usize > > {
143
+ if self . params . enable_trie_cache {
144
+ Ok ( self . import_params ( ) . map ( |x| x. trie_cache_maximum_size ( ) ) . unwrap_or_default ( ) )
145
+ } else {
146
+ Ok ( None )
147
+ }
148
+ }
135
149
}
Original file line number Diff line number Diff line change @@ -75,6 +75,12 @@ pub struct OverheadParams {
75
75
/// Good for adding LICENSE headers.
76
76
#[ clap( long, value_name = "PATH" ) ]
77
77
pub header : Option < PathBuf > ,
78
+
79
+ /// Enable the Trie cache.
80
+ ///
81
+ /// This should only be used for performance analysis and not for final results.
82
+ #[ clap( long) ]
83
+ pub enable_trie_cache : bool ,
78
84
}
79
85
80
86
/// Type of a benchmark.
@@ -156,4 +162,12 @@ impl CliConfiguration for OverheadCmd {
156
162
fn import_params ( & self ) -> Option < & ImportParams > {
157
163
Some ( & self . import_params )
158
164
}
165
+
166
+ fn trie_cache_maximum_size ( & self ) -> Result < Option < usize > > {
167
+ if self . params . enable_trie_cache {
168
+ Ok ( self . import_params ( ) . map ( |x| x. trie_cache_maximum_size ( ) ) . unwrap_or_default ( ) )
169
+ } else {
170
+ Ok ( None )
171
+ }
172
+ }
159
173
}
Original file line number Diff line number Diff line change @@ -105,9 +105,15 @@ pub struct StorageParams {
105
105
/// Trie cache size in bytes.
106
106
///
107
107
/// Providing `0` will disable the cache.
108
- #[ clap( long, default_value = "1024 " ) ]
108
+ #[ clap( long, value_name = "Bytes" , default_value = "67108864 " ) ]
109
109
pub trie_cache_size : usize ,
110
110
111
+ /// Enable the Trie cache.
112
+ ///
113
+ /// This should only be used for performance analysis and not for final results.
114
+ #[ clap( long) ]
115
+ pub enable_trie_cache : bool ,
116
+
111
117
/// Include child trees in benchmark.
112
118
#[ clap( long) ]
113
119
pub include_child_trees : bool ,
@@ -220,10 +226,10 @@ impl CliConfiguration for StorageCmd {
220
226
}
221
227
222
228
fn trie_cache_maximum_size ( & self ) -> Result < Option < usize > > {
223
- if self . params . trie_cache_size == 0 {
224
- Ok ( None )
225
- } else {
229
+ if self . params . enable_trie_cache && self . params . trie_cache_size > 0 {
226
230
Ok ( Some ( self . params . trie_cache_size ) )
231
+ } else {
232
+ Ok ( None )
227
233
}
228
234
}
229
235
}
You can’t perform that action at this time.
0 commit comments