-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
chore(gas_price_service): refactor usage of async_trait impls to improve performance #2632
Conversation
@@ -203,7 +203,6 @@ mod tests { | |||
l2_block: mpsc::Receiver<BlockInfo>, | |||
} | |||
|
|||
#[async_trait::async_trait] | |||
impl L2BlockSource for FakeL2BlockSource { | |||
async fn get_l2_block(&mut self) -> GasPriceResult<BlockInfo> { |
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.
Does the async
still work here? I'm not sure if it desugars to the same.
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.
yes
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.
Yeah. I'm playing around with it in playground. Works for me.
Linked Issues/PRs
Description
reduces heap allocs by removing usage of
async_trait
for small types being passed around in gas price service adapters. should improve performance because noPin<Box<Future>>>
for small values which can be efficiently allocated on the stack instead.microbenchmarks yield performance increase of$$\approx 82.57\% %$$ for
get_l2_block
makes
GasPriceProvider
syncbreaking:
consumers of the
L2BlockSource
andGasPriceProvider
traits, which is most likely just us at this pointChecklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]