Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check insert optimization for bank_forks #24641

Merged
merged 2 commits into from Apr 26, 2022
Merged

Conversation

HaoranYi
Copy link
Contributor

@HaoranYi HaoranYi commented Apr 25, 2022

Problem

When inserting parent into bank_forks, we perform a check for existence then do the actual insert. This can be optimized by do the insert first, then check that if return is None. Thus, it saves one lookup of the parents.

Summary of Changes

Do the insert first, then check the return value.

Fixes #

@HaoranYi HaoranYi requested a review from carllin April 25, 2022 16:24
@HaoranYi HaoranYi mentioned this pull request Apr 25, 2022
@HaoranYi HaoranYi merged commit 9044cd7 into solana-labs:master Apr 26, 2022
@HaoranYi HaoranYi deleted the insert branch April 26, 2022 00:17
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Apr 27, 2022
* check insert optimization

* clippy suggested simplification
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* check insert optimization

* clippy suggested simplification
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* check insert optimization

* clippy suggested simplification
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* check insert optimization

* clippy suggested simplification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants