mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +00:00
Trivial BlockId::Number => Hash (#12490)
This commit is contained in:
committed by
GitHub
parent
1b3f211efa
commit
dcd56b1ffd
@@ -27,14 +27,14 @@ fn sp_api_benchmark(c: &mut Criterion) {
|
|||||||
c.bench_function("add one with same runtime api", |b| {
|
c.bench_function("add one with same runtime api", |b| {
|
||||||
let client = substrate_test_runtime_client::new();
|
let client = substrate_test_runtime_client::new();
|
||||||
let runtime_api = client.runtime_api();
|
let runtime_api = client.runtime_api();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
|
|
||||||
b.iter(|| runtime_api.benchmark_add_one(&block_id, &1))
|
b.iter(|| runtime_api.benchmark_add_one(&block_id, &1))
|
||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("add one with recreating runtime api", |b| {
|
c.bench_function("add one with recreating runtime api", |b| {
|
||||||
let client = substrate_test_runtime_client::new();
|
let client = substrate_test_runtime_client::new();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
|
|
||||||
b.iter(|| client.runtime_api().benchmark_add_one(&block_id, &1))
|
b.iter(|| client.runtime_api().benchmark_add_one(&block_id, &1))
|
||||||
});
|
});
|
||||||
@@ -42,7 +42,7 @@ fn sp_api_benchmark(c: &mut Criterion) {
|
|||||||
c.bench_function("vector add one with same runtime api", |b| {
|
c.bench_function("vector add one with same runtime api", |b| {
|
||||||
let client = substrate_test_runtime_client::new();
|
let client = substrate_test_runtime_client::new();
|
||||||
let runtime_api = client.runtime_api();
|
let runtime_api = client.runtime_api();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
let data = vec![0; 1000];
|
let data = vec![0; 1000];
|
||||||
|
|
||||||
b.iter_with_large_drop(|| runtime_api.benchmark_vector_add_one(&block_id, &data))
|
b.iter_with_large_drop(|| runtime_api.benchmark_vector_add_one(&block_id, &data))
|
||||||
@@ -50,7 +50,7 @@ fn sp_api_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("vector add one with recreating runtime api", |b| {
|
c.bench_function("vector add one with recreating runtime api", |b| {
|
||||||
let client = substrate_test_runtime_client::new();
|
let client = substrate_test_runtime_client::new();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
let data = vec![0; 1000];
|
let data = vec![0; 1000];
|
||||||
|
|
||||||
b.iter_with_large_drop(|| client.runtime_api().benchmark_vector_add_one(&block_id, &data))
|
b.iter_with_large_drop(|| client.runtime_api().benchmark_vector_add_one(&block_id, &data))
|
||||||
@@ -60,7 +60,7 @@ fn sp_api_benchmark(c: &mut Criterion) {
|
|||||||
let client = TestClientBuilder::new()
|
let client = TestClientBuilder::new()
|
||||||
.set_execution_strategy(ExecutionStrategy::AlwaysWasm)
|
.set_execution_strategy(ExecutionStrategy::AlwaysWasm)
|
||||||
.build();
|
.build();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
b.iter(|| client.runtime_api().benchmark_indirect_call(&block_id).unwrap())
|
b.iter(|| client.runtime_api().benchmark_indirect_call(&block_id).unwrap())
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ fn sp_api_benchmark(c: &mut Criterion) {
|
|||||||
let client = TestClientBuilder::new()
|
let client = TestClientBuilder::new()
|
||||||
.set_execution_strategy(ExecutionStrategy::AlwaysWasm)
|
.set_execution_strategy(ExecutionStrategy::AlwaysWasm)
|
||||||
.build();
|
.build();
|
||||||
let block_id = BlockId::Number(client.chain_info().best_number);
|
let block_id = BlockId::Hash(client.chain_info().best_hash);
|
||||||
b.iter(|| client.runtime_api().benchmark_direct_call(&block_id).unwrap())
|
b.iter(|| client.runtime_api().benchmark_direct_call(&block_id).unwrap())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user