-
Notifications
You must be signed in to change notification settings - Fork 44
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: spawn jsr futures on executor #395
Conversation
lib/lib.rs
Outdated
&self, | ||
future: futures::future::LocalBoxFuture<'static, ()>, | ||
) -> futures::future::LocalBoxFuture<'static, ()> { | ||
// TODO(littledivy): bug in wasm_bindgen where Shared futures panic on spawn. |
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.
I can't test the perf in Deno because it is a few deno_graph versions behind it seems. Are there any other benchmarks I can run? @dsherret |
@littledivy it's up-to-date. Pull the latest main. |
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.
Thanks so much for looking into this!
fn execute(&self, fut: BoxedFuture) -> BoxedFuture; | ||
} | ||
|
||
impl<'a> Default for &'a dyn Executor { |
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, I did not know it was possible to do this for traits.
2.5x faster on incremental and half peak memory usage:
5+ seconds faster with no cache (network is involved):
|
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.
LGTM!
Adds an abstract trait for executing futures onto an async runtime.
A default Tokio spawn executor is included behing the
tokio_executor
feature flag.Closes #394