mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Update master benchmarks (#5230)
* try more samples * try increase span * reaping bench + config * wip * ed25519 block import * update naming * align names * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update bin/node/testing/benches/import.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * use existential deposit Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
//! It is not supposed to measure runtime modules weight correctness
|
||||
|
||||
use std::fmt;
|
||||
use node_testing::bench::{BenchDb, Profile};
|
||||
use node_testing::bench::{BenchDb, Profile, BlockType, KeyTypes};
|
||||
use node_primitives::Block;
|
||||
use sp_runtime::generic::BlockId;
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
@@ -37,8 +37,8 @@ use sc_client_api::backend::Backend;
|
||||
|
||||
criterion_group!(
|
||||
name = benches;
|
||||
config = Criterion::default().sample_size(20).warm_up_time(std::time::Duration::from_secs(20));
|
||||
targets = bench_block_import
|
||||
config = Criterion::default().sample_size(50).warm_up_time(std::time::Duration::from_secs(20));
|
||||
targets = bench_block_import, bench_account_reaping, bench_account_ed25519
|
||||
);
|
||||
criterion_group!(
|
||||
name = wasm_size;
|
||||
@@ -57,8 +57,8 @@ fn bench_block_import(c: &mut Criterion) {
|
||||
// for future uses, uncomment if something wrong.
|
||||
// sc_cli::init_logger("sc_client=debug");
|
||||
|
||||
let mut bench_db = BenchDb::new(128);
|
||||
let block = bench_db.generate_block(100);
|
||||
let mut bench_db = BenchDb::new(100);
|
||||
let block = bench_db.generate_block(BlockType::RandomTransfers(100));
|
||||
|
||||
log::trace!(
|
||||
target: "bench-logistics",
|
||||
@@ -66,7 +66,7 @@ fn bench_block_import(c: &mut Criterion) {
|
||||
bench_db.path().display(),
|
||||
);
|
||||
|
||||
c.bench_function_over_inputs("import block",
|
||||
c.bench_function_over_inputs("import-block-B-0001",
|
||||
move |bencher, profile| {
|
||||
bencher.iter_batched(
|
||||
|| {
|
||||
@@ -104,7 +104,61 @@ fn bench_block_import(c: &mut Criterion) {
|
||||
.expect("RocksDB backend always provides usage info!"),
|
||||
);
|
||||
},
|
||||
criterion::BatchSize::PerIteration,
|
||||
criterion::BatchSize::LargeInput,
|
||||
);
|
||||
},
|
||||
vec![Profile::Wasm, Profile::Native],
|
||||
);
|
||||
}
|
||||
|
||||
fn bench_account_reaping(c: &mut Criterion) {
|
||||
sc_cli::init_logger("");
|
||||
|
||||
let mut bench_db = BenchDb::new(100);
|
||||
let block = bench_db.generate_block(BlockType::RandomTransfersReaping(100));
|
||||
|
||||
c.bench_function_over_inputs("import-block-reaping-B-0002",
|
||||
move |bencher, profile| {
|
||||
bencher.iter_batched(
|
||||
|| {
|
||||
let context = bench_db.create_context(*profile);
|
||||
|
||||
// mostly to just launch compiler before benching!
|
||||
context.client.runtime_version_at(&BlockId::Number(0))
|
||||
.expect("Failed to get runtime version");
|
||||
|
||||
context
|
||||
},
|
||||
|mut context| {
|
||||
context.import_block(block.clone());
|
||||
},
|
||||
criterion::BatchSize::LargeInput,
|
||||
);
|
||||
},
|
||||
vec![Profile::Wasm, Profile::Native],
|
||||
);
|
||||
}
|
||||
|
||||
fn bench_account_ed25519(c: &mut Criterion) {
|
||||
sc_cli::init_logger("");
|
||||
|
||||
let mut bench_db = BenchDb::with_key_types(100, KeyTypes::Ed25519);
|
||||
let block = bench_db.generate_block(BlockType::RandomTransfers(100));
|
||||
|
||||
c.bench_function_over_inputs("import-block-ed25519-B-0003",
|
||||
move |bencher, profile| {
|
||||
bencher.iter_batched(
|
||||
|| {
|
||||
let context = bench_db.create_context(*profile);
|
||||
context.client.runtime_version_at(&BlockId::Number(0))
|
||||
.expect("Failed to get runtime version");
|
||||
|
||||
context
|
||||
},
|
||||
|mut context| {
|
||||
context.import_block(block.clone());
|
||||
},
|
||||
criterion::BatchSize::LargeInput,
|
||||
);
|
||||
},
|
||||
vec![Profile::Wasm, Profile::Native],
|
||||
@@ -118,7 +172,7 @@ fn profile_block_import(c: &mut Criterion) {
|
||||
sc_cli::init_logger("");
|
||||
|
||||
let mut bench_db = BenchDb::new(128);
|
||||
let block = bench_db.generate_block(100);
|
||||
let block = bench_db.generate_block(BlockType::RandomTransfers(100));
|
||||
|
||||
c.bench_function("profile block",
|
||||
move |bencher| {
|
||||
@@ -174,7 +228,7 @@ impl Iterator for SetupIterator {
|
||||
|
||||
let size = self.current * self.multiplier;
|
||||
let mut db = BenchDb::new(size);
|
||||
let block = db.generate_block(size);
|
||||
let block = db.generate_block(BlockType::RandomTransfers(size));
|
||||
Some(Setup { db, block })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user