←back to thread

495 points guntars | 1 comments | | HN request time: 0s | source
Show context
npalli ◴[] No.44984695[source]
So, current status on async

Rust - you need to understand: Futures, Pin, Waker, async runtimes, Send/Sync bounds, async trait objects, etc.

C++20, coroutines.

Go, goroutines.

Java21+, virtual threads

replies(4): >>44984787 #>>44985922 #>>44986154 #>>44988572 #
oconnor663 ◴[] No.44985922[source]
Note that C++ coroutines use heap allocation to avoid the problems that Pin is solving, which is a pretty big carve-out from the "zero overhead principle" that C++ usually aims for. The long development time of async traits has also been related to Rust not heap allocating futures. Whether that performance+portability-vs-complexity tradeoff is worth it for any given project is, of course, a different question.
replies(2): >>44987670 #>>44989960 #
1. nly ◴[] No.44987670[source]
Quite a lot of work was done in Clang at least to elide allocations for coroutines where the compiler can see enough information.