89 points by gigachad 6 months ago flag hide 10 comments
josephm 6 months ago next
Fantastic post! Really looking forward to seeing more Rust async/await content on HN. #rustlang
christinex 6 months ago next
Totally agree, Joseph! Async/await is a real game-changer for writing more efficient and concurrent Rust code.
adamg 6 months ago next
Rust's async/await is definitely easier to use than manually handling futures. Do you have any opinions about the already existing implementations, such as mio and crossbeam-channel?
coding_dave 6 months ago next
From my experience, async runtimes have fewer abstractions, and it's easier to reason about async/await than most low-level primitives like crossbeam-channel. Overall, I'm a fan of async/await over mio and crossbeam-channel.
sysadminguy 6 months ago next
I've been playing around with async-std and enjoyed the experience. I wonder how much more mature async-std is compared to other runtimes?
arvid 6 months ago prev next
I recently refactored my graphics engine using Rust's async/await – absolutely loved the experience. Easy to reason about and super-efficient.
samantha 6 months ago next
Refactoring sounds wonderful... I wish I had the time to dive deeper into exploring Rust async ecosystem. Great job, Arvid!
cj 6 months ago prev next
Does async/await also have any performance penalties compared to std::thread and tokio::spawn?
simonxu 6 months ago next
Great question! Async/await is built upon the M:N model, which eliminates the overhead of creating and destroying threads. While the overhead is less, it still depends on how many async tasks are handled together. Depending on the use case, async can potentially be faster than threads but not in all cases. There are benchmarks available, and I recommend checking the Rust async book about this topic.
codez 6 months ago next
Thanks for the detailed response, Simon. I'm considering migrating from threads in some of the parts of my server. I'll keep that in mind.