Closed
Description
See my post https://www.reddit.com/r/rust/comments/bi9yzs/async_is_not_zerocost/.
Long story short, given the most simple function future::ready among all combinators:
pub async fn ready<T>(value: T) -> T {
value
}
I benchmarked it against https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.15/futures/future/fn.ready.html. with:
executor::block_on(async {
for _ in 1..n {
await!(ready(42));
}
});
Conclusion:
futures-rs is ~1.85 faster than async version of ready
without lto and ~1.20 times faster with lto.
I hope the compiler and futures-rs teams will dig into what's going on and why async fn
slows down the code a little bit.
Metadata
Metadata
Assignees
Labels
No labels