benches: disable caching per default (#12232)

* Disable cache for storage benches

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Disable caching per default

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update utils/frame/benchmarking-cli/src/storage/cmd.rs

Co-authored-by: Bastian Köcher <info@kchr.de>

* Add --enable-trie-cache to 'storage' command

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Oliver Tale-Yazdi
2022-09-13 13:32:34 +02:00
committed by GitHub
parent b494167d16
commit 9bbede8e00
4 changed files with 52 additions and 4 deletions
@@ -105,9 +105,15 @@ pub struct StorageParams {
/// Trie cache size in bytes.
///
/// Providing `0` will disable the cache.
#[clap(long, default_value = "1024")]
#[clap(long, value_name = "Bytes", default_value = "67108864")]
pub trie_cache_size: usize,
/// Enable the Trie cache.
///
/// This should only be used for performance analysis and not for final results.
#[clap(long)]
pub enable_trie_cache: bool,
/// Include child trees in benchmark.
#[clap(long)]
pub include_child_trees: bool,
@@ -220,10 +226,10 @@ impl CliConfiguration for StorageCmd {
}
fn trie_cache_maximum_size(&self) -> Result<Option<usize>> {
if self.params.trie_cache_size == 0 {
Ok(None)
} else {
if self.params.enable_trie_cache && self.params.trie_cache_size > 0 {
Ok(Some(self.params.trie_cache_size))
} else {
Ok(None)
}
}
}