mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Make election benchmarks more *memory-aware* (#9286)
* Make benchmarks a bit better with mem * Make election benchmarks more *memory-aware* * Fix a few errors * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Manually fix the weights * Update lock file * remove dupe * Fix tests * cargo update pwasm Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
@@ -554,6 +554,19 @@ sp_npos_elections::generate_solution_type!(
|
||||
pub const MAX_NOMINATIONS: u32 =
|
||||
<NposCompactSolution16 as sp_npos_elections::CompactSolution>::LIMIT as u32;
|
||||
|
||||
/// The numbers configured here should always be more than the the maximum limits of staking pallet
|
||||
/// to ensure election snapshot will not run out of memory.
|
||||
pub struct BenchmarkConfig;
|
||||
impl pallet_election_provider_multi_phase::BenchmarkingConfig for BenchmarkConfig {
|
||||
const VOTERS: [u32; 2] = [5_000, 10_000];
|
||||
const TARGETS: [u32; 2] = [1_000, 2_000];
|
||||
const ACTIVE_VOTERS: [u32; 2] = [1000, 4_000];
|
||||
const DESIRED_TARGETS: [u32; 2] = [400, 800];
|
||||
const SNAPSHOT_MAXIMUM_VOTERS: u32 = 25_000;
|
||||
const MINER_MAXIMUM_VOTERS: u32 = 15_000;
|
||||
const MAXIMUM_TARGETS: u32 = 2000;
|
||||
}
|
||||
|
||||
impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
@@ -579,7 +592,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type Fallback = Fallback;
|
||||
type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight<Runtime>;
|
||||
type ForceOrigin = EnsureRootOrHalfCouncil;
|
||||
type BenchmarkingConfig = ();
|
||||
type BenchmarkingConfig = BenchmarkConfig;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -1578,7 +1591,6 @@ impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, pallet_uniques, Uniques);
|
||||
add_benchmark!(params, batches, pallet_utility, Utility);
|
||||
add_benchmark!(params, batches, pallet_vesting, Vesting);
|
||||
add_benchmark!(params, batches, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok((batches, storage_info))
|
||||
|
||||
Reference in New Issue
Block a user