mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +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:
@@ -330,11 +330,11 @@ impl multi_phase::weights::WeightInfo for DualMockWeightInfo {
|
||||
<() as multi_phase::weights::WeightInfo>::submit(c)
|
||||
}
|
||||
}
|
||||
fn elect_queued() -> Weight {
|
||||
fn elect_queued(v: u32, t: u32, a: u32, d: u32) -> Weight {
|
||||
if MockWeightInfo::get() {
|
||||
Zero::zero()
|
||||
} else {
|
||||
<() as multi_phase::weights::WeightInfo>::elect_queued()
|
||||
<() as multi_phase::weights::WeightInfo>::elect_queued(v, t, a, d)
|
||||
}
|
||||
}
|
||||
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32) -> Weight {
|
||||
@@ -438,6 +438,32 @@ impl ElectionDataProvider<AccountId, u64> for StakingMock {
|
||||
Targets::set(targets);
|
||||
Voters::set(voters);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-benchmarks", test))]
|
||||
fn clear() {
|
||||
Targets::set(vec![]);
|
||||
Voters::set(vec![]);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-benchmarks", test))]
|
||||
fn add_voter(voter: AccountId, weight: VoteWeight, targets: Vec<AccountId>) {
|
||||
let mut current = Voters::get();
|
||||
current.push((voter, weight, targets));
|
||||
Voters::set(current);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-benchmarks", test))]
|
||||
fn add_target(target: AccountId) {
|
||||
let mut current = Targets::get();
|
||||
current.push(target);
|
||||
Targets::set(current);
|
||||
|
||||
// to be on-par with staking, we add a self vote as well. the stake is really not that
|
||||
// important.
|
||||
let mut current = Voters::get();
|
||||
current.push((target, ExistentialDeposit::get() as u64, vec![target]));
|
||||
Voters::set(current);
|
||||
}
|
||||
}
|
||||
|
||||
impl ExtBuilder {
|
||||
|
||||
Reference in New Issue
Block a user