mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
properly handle different block content (#6007)
This commit is contained in:
@@ -50,19 +50,19 @@ pub enum SizeType {
|
||||
#[display(fmt = "full")]
|
||||
Full,
|
||||
#[display(fmt = "custom")]
|
||||
Custom,
|
||||
Custom(usize),
|
||||
}
|
||||
|
||||
impl SizeType {
|
||||
pub fn transactions(&self) -> usize {
|
||||
pub fn transactions(&self) -> Option<usize> {
|
||||
match self {
|
||||
SizeType::Empty => 0,
|
||||
SizeType::Small => 10,
|
||||
SizeType::Medium => 100,
|
||||
SizeType::Large => 500,
|
||||
SizeType::Full => 4000,
|
||||
SizeType::Empty => Some(0),
|
||||
SizeType::Small => Some(10),
|
||||
SizeType::Medium => Some(100),
|
||||
SizeType::Large => Some(500),
|
||||
SizeType::Full => None,
|
||||
// Custom SizeType will use the `--transactions` input parameter
|
||||
SizeType::Custom => 0,
|
||||
SizeType::Custom(val) => Some(*val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,9 +97,9 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription {
|
||||
}
|
||||
|
||||
match self.block_type {
|
||||
BlockType::RandomTransfersKeepAlive(_) => path.push("transfer_keep_alive"),
|
||||
BlockType::RandomTransfersReaping(_) => path.push("transfer_reaping"),
|
||||
BlockType::Noop(_) => path.push("noop"),
|
||||
BlockType::RandomTransfersKeepAlive => path.push("transfer_keep_alive"),
|
||||
BlockType::RandomTransfersReaping => path.push("transfer_reaping"),
|
||||
BlockType::Noop => path.push("noop"),
|
||||
}
|
||||
|
||||
match self.database_type {
|
||||
@@ -119,7 +119,7 @@ impl core::BenchmarkDescription for ImportBenchmarkDescription {
|
||||
50_000,
|
||||
self.key_types
|
||||
);
|
||||
let block = bench_db.generate_block(self.block_type);
|
||||
let block = bench_db.generate_block(self.block_type.to_content(self.size.transactions()));
|
||||
Box::new(ImportBenchmark {
|
||||
database: bench_db,
|
||||
block,
|
||||
|
||||
@@ -79,19 +79,15 @@ fn main() {
|
||||
SizeType::Medium,
|
||||
SizeType::Large,
|
||||
SizeType::Full,
|
||||
SizeType::Custom,
|
||||
SizeType::Custom(opt.transactions.unwrap_or(0)),
|
||||
].iter() {
|
||||
let txs = match size {
|
||||
SizeType::Custom => opt.transactions.unwrap_or(0),
|
||||
_ => size.transactions()
|
||||
};
|
||||
for block_type in [
|
||||
BlockType::RandomTransfersKeepAlive(txs),
|
||||
BlockType::RandomTransfersReaping(txs),
|
||||
BlockType::Noop(txs),
|
||||
BlockType::RandomTransfersKeepAlive,
|
||||
BlockType::RandomTransfersReaping,
|
||||
BlockType::Noop,
|
||||
].iter() {
|
||||
for database_type in [BenchDataBaseType::RocksDb, BenchDataBaseType::ParityDb].iter() {
|
||||
import_benchmarks.push((profile, size, block_type.clone(), database_type));
|
||||
import_benchmarks.push((profile, size.clone(), block_type.clone(), database_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +98,7 @@ fn main() {
|
||||
ImportBenchmarkDescription {
|
||||
profile: *profile,
|
||||
key_types: KeyTypes::Sr25519,
|
||||
size: *size,
|
||||
size: size,
|
||||
block_type: block_type,
|
||||
database_type: *database_type,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user