-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
perf: query accounts with &Address
to avoid copying address
#13554
Conversation
@@ -367,7 +367,7 @@ where | |||
let state = maybe_state.as_deref().expect("provider is set"); | |||
|
|||
// Use provider to get account info | |||
let account = match state.basic_account(transaction.sender()) { | |||
let account = match state.basic_account(transaction.sender_ref()) { |
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.
Main dance.
fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>> { | ||
Ok(self.tx.get::<tables::PlainAccountState>(address)?) | ||
fn basic_account(&self, address: &Address) -> ProviderResult<Option<Account>> { | ||
Ok(self.tx.get_by_encoded_key::<tables::PlainAccountState>(address)?) |
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.
Main dance.
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.
makes sense to avoid the copy here
fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>> { | ||
self.tx().get::<tables::PlainAccountState>(address).map_err(Into::into) | ||
fn basic_account(&self, address: &Address) -> ProviderResult<Option<Account>> { | ||
self.tx().get_by_encoded_key::<tables::PlainAccountState>(address).map_err(Into::into) |
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.
Main dance.
CodSpeed Performance ReportMerging #13554 will improve performances by 10.48%Comparing Summary
Benchmarks breakdown
|
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.
cool, this makes sense
fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>> { | ||
Ok(self.tx.get::<tables::PlainAccountState>(address)?) | ||
fn basic_account(&self, address: &Address) -> ProviderResult<Option<Account>> { | ||
Ok(self.tx.get_by_encoded_key::<tables::PlainAccountState>(address)?) |
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.
makes sense to avoid the copy here
Following #13171 towards #12838.