This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Get rid of unnecessary cloning and work. #6808
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eskimor
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.
labels
Mar 1, 2023
eskimor
commented
Mar 1, 2023
// Must be called _after_ `fn cache_session_info_for_head` | ||
// which guarantees that the session info is available | ||
// for the current session. | ||
let session_info: &SessionInfo = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By moving this cheap call into the loop, we can avoid the costly clone.
Very good catch! I'm curious to see how much this will improve the vote processing. |
tdimitrov
approved these changes
Mar 1, 2023
BradleyOlson64
approved these changes
Mar 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Had fun digging into why the cheap call needed to be in the loop.
mrcnski
approved these changes
Mar 1, 2023
ghost
approved these changes
Mar 1, 2023
bot merge |
Error: Statuses failed for ce59ad5 |
ordian
added a commit
that referenced
this pull request
Mar 7, 2023
* master: (27 commits) bump `zombienet` version to v1.3.37 (#6773) Bump `blake2b_simd` to 1.0.1 (#6829) changelog: update template for new label behavior (E3/E4) (#6804) Companion for paritytech/substrate#12828 (#6380) Don't send `ActiveLeaves` from leaves in db on startup in Overseer (#6727) Polkadot XCM Body constants (#6788) Decrease expected peer count in zombinenet tests (#6826) Additional tracing in `provisioner`, `vote_selection` and `dispute-coordinator` (#6775) Change node-key for bootnodes (#6772) Change handle_import_statements to FatalResult (#6820) Introduce XCM matcher for writing barriers (#6756) Freeze note on `SessionInfo`. (#6818) Bump parity-db (#6816) Removing Outdated References to Misbehavior Arbitration Subsystem (#6814) Forgotten re-export for `MatchedConvertedConcreteId` (#6815) Companion for substrate#13509: bump API versions of {Beefy,Mmr}Api (#6809) Migrate to `Weight::from_parts` (#6794) [XCM] Multiple `FungiblesAdapter`s support + `WeightTrader::buy_weight` more accurate error (#6739) Get rid of unnecessary cloning and work. (#6808) changelog: fix migration listing (#6806) ...
ordian
added a commit
that referenced
this pull request
Mar 7, 2023
* master: (27 commits) bump `zombienet` version to v1.3.37 (#6773) Bump `blake2b_simd` to 1.0.1 (#6829) changelog: update template for new label behavior (E3/E4) (#6804) Companion for paritytech/substrate#12828 (#6380) Don't send `ActiveLeaves` from leaves in db on startup in Overseer (#6727) Polkadot XCM Body constants (#6788) Decrease expected peer count in zombinenet tests (#6826) Additional tracing in `provisioner`, `vote_selection` and `dispute-coordinator` (#6775) Change node-key for bootnodes (#6772) Change handle_import_statements to FatalResult (#6820) Introduce XCM matcher for writing barriers (#6756) Freeze note on `SessionInfo`. (#6818) Bump parity-db (#6816) Removing Outdated References to Misbehavior Arbitration Subsystem (#6814) Forgotten re-export for `MatchedConvertedConcreteId` (#6815) Companion for substrate#13509: bump API versions of {Beefy,Mmr}Api (#6809) Migrate to `Weight::from_parts` (#6794) [XCM] Multiple `FungiblesAdapter`s support + `WeightTrader::buy_weight` more accurate error (#6739) Get rid of unnecessary cloning and work. (#6808) changelog: fix migration listing (#6806) ...
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Noticed when studying the logs that we do quite a bit of unnecessary work - studying the code, it was even worse than it looked like. Not only that we fetch the session info for each and every vote in a dispute, we also cloned the
SessionInfo
each time, while in reality no clone at all is necessary. This PR therefore gets rid of ~500SessionInfo
clones per dispute (on Versi).This should be quite some speedup for vote import from chain. I also removed a costly debug assert - it served its purpose and is likely causing significant slowdown on testnets.