Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

update weights #5361

Merged
merged 4 commits into from
Apr 22, 2022
Merged

update weights #5361

merged 4 commits into from
Apr 22, 2022

Conversation

coderobe
Copy link
Contributor

@coderobe coderobe commented Apr 21, 2022

🏋️

see release PR here

@coderobe coderobe added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. labels Apr 21, 2022
This was referenced Apr 21, 2022
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, looks like some of the weights have not been updated in a year!

I am currently writing a tool as side project which automates the review process…

Copy link
Contributor

@chevdor chevdor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spotted a few "big" changes in the review but the weights remained rather stable overall.

Comment on lines 55 to 59
fn on_initialize_nothing() -> Weight {
(23_878_000 as Weight).saturating_add(T::DbWeight::get().reads(8 as Weight))
(12_441_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: Around 50% reduction for the election provider and phragmen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is since they were not updated since paritytech/substrate#10692. although they should have been 🤷

Comment on lines +47 to +59
// Storage: PhragmenElection Candidates (r:1 w:0)
// Storage: PhragmenElection Members (r:1 w:0)
// Storage: PhragmenElection RunnersUp (r:1 w:0)
// Storage: PhragmenElection Voting (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn vote_equal(v: u32, ) -> Weight {
(20_639_000 as Weight)
// Standard Error: 7_000
.saturating_add((200_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vote_more(v: u32) -> Weight {
(83_389_000 as Weight)
.saturating_add((341_000 as Weight).saturating_mul(v as Weight))
// Storage: PhragmenElection Candidates (r:1 w:0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: Around 50% reduction for the election provider and phragmen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can likely be attributed to the fact that those weights hadn't been updated in well over a year

Comment on lines 49 to 57
// Storage: Preimage StatusFor (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 28_000
.saturating_add((23_540_000 as Weight).saturating_mul(s as Weight))
(1_758_000 as Weight)
// Standard Error: 30_000
.saturating_add((24_061_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big change

Comment on lines 64 to 70
fn on_initialize_named_resolved(s: u32, ) -> Weight {
(1_922_000 as Weight)
// Standard Error: 21_000
.saturating_add((18_731_000 as Weight).saturating_mul(s as Weight))
(452_000 as Weight)
// Standard Error: 29_000
.saturating_add((19_512_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big change

Comment on lines 123 to 129
fn on_initialize(n: u32, ) -> Weight {
(2_126_000 as Weight)
// Standard Error: 19_000
.saturating_add((48_336_000 as Weight).saturating_mul(n as Weight))
(0 as Weight)
// Standard Error: 20_000
.saturating_add((49_389_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big change

Comment on lines 45 to 51
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
fn remark(b: u32, ) -> Weight {
(0 as Weight)
(2_551_000 as Weight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big increase

Comment on lines 53 to 65
// Storage: Staking ForceEra (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
fn on_initialize_nothing() -> Weight {
(23_878_000 as Weight).saturating_add(T::DbWeight::get().reads(8 as Weight))
(12_276_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn on_initialize_open_signed() -> Weight {
(34_547_000 as Weight)
(11_448_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50%-ish decrease in pallet

Comment on lines 49 to 57
// Storage: Preimage StatusFor (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 31_000
.saturating_add((23_661_000 as Weight).saturating_mul(s as Weight))
(1_442_000 as Weight)
// Standard Error: 60_000
.saturating_add((24_552_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big increase

Comment on lines 74 to 82
// Storage: Preimage PreimageFor (r:1 w:1)
// Storage: Preimage StatusFor (r:1 w:1)
fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
(847_000 as Weight)
(34_000 as Weight)
// Standard Error: 29_000
.saturating_add((21_351_000 as Weight).saturating_mul(s as Weight))
.saturating_add((22_211_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big decrease

Comment on lines 121 to 129
// Storage: Auctions ReservedAmounts (r:2 w:2)
// Storage: System Account (r:2 w:2)
fn on_initialize(n: u32, ) -> Weight {
(2_735_000 as Weight)
// Standard Error: 17_000
.saturating_add((46_633_000 as Weight).saturating_mul(n as Weight))
(0 as Weight)
// Standard Error: 18_000
.saturating_add((49_564_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big decrease

@coderobe
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit ef922a7 into master Apr 22, 2022
@coderobe coderobe deleted the coderobe/weights-20-m branch April 22, 2022 09:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants