node-bench no-op block import (#5869)

* start to try and implement noop

* txs as input

* better comment

* Add transfer reaping

* rename to avoid filter matching

* Update base weights based on results

* fix priority

* fix logic on reaping transfer

* Update bin/node/bench/src/import.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update bin/node/bench/src/main.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* add back size type (in-progress)

* bring back size type with custom

* update comment

* nit

* block type then size

* Use `transfer_keep_alive`

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
Shawn Tabrizi
2020-05-03 15:33:11 +02:00
committed by GitHub
parent 51db82bdb9
commit f37927d37d
6 changed files with 99 additions and 63 deletions
+19 -13
View File
@@ -49,16 +49,20 @@ pub enum SizeType {
Large,
#[display(fmt = "full")]
Full,
#[display(fmt = "custom")]
Custom,
}
impl SizeType {
fn transactions(&self) -> usize {
pub fn transactions(&self) -> usize {
match self {
SizeType::Empty => 0,
SizeType::Small => 10,
SizeType::Medium => 100,
SizeType::Large => 500,
SizeType::Full => 4000,
// Custom SizeType will use the `--transactions` input parameter
SizeType::Custom => 0,
}
}
}
@@ -66,6 +70,7 @@ impl SizeType {
pub struct ImportBenchmarkDescription {
pub profile: Profile,
pub key_types: KeyTypes,
pub block_type: BlockType,
pub size: SizeType,
}
@@ -90,6 +95,12 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription {
KeyTypes::Ed25519 => path.push("ed25519"),
}
match self.block_type {
BlockType::RandomTransfersKeepAlive(_) => path.push("transfer_keep_alive"),
BlockType::RandomTransfersReaping(_) => path.push("transfer_reaping"),
BlockType::Noop(_) => path.push("noop"),
}
path.push(&format!("{}", self.size));
path
@@ -101,7 +112,7 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription {
50_000,
self.key_types
);
let block = bench_db.generate_block(BlockType::RandomTransfers(self.size.transactions()));
let block = bench_db.generate_block(self.block_type);
Box::new(ImportBenchmark {
database: bench_db,
block,
@@ -110,16 +121,11 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription {
}
fn name(&self) -> Cow<'static, str> {
match self.profile {
Profile::Wasm => format!(
"Import benchmark (random transfers, wasm, {} block)",
self.size,
).into(),
Profile::Native => format!(
"Import benchmark (random transfers, native, {} block)",
self.size,
).into(),
}
format!(
"Import benchmark ({:?}, {:?})",
self.block_type,
self.profile,
).into()
}
}
@@ -159,4 +165,4 @@ impl core::Benchmark for ImportBenchmark {
elapsed
}
}
}