3 ms·
When you block the OS does the same thing - yields to other threads.
by groundzeros2015 6mo ago
When you block the OS does the same thing - yields to other threads.
- Salgat 6mo agoAnd how much slower is that? What happens when I run a thousand async tasks? I'll give you a hint, with async/await, it has barely any overhead.
- bigstrat2003 6mo agoThe vast, vast majority of programmers are going to be writing software where there are only a handful of threads (if that). The "I need thousands of concurrent executions" case is simply not relevant to most people.
- Salgat 6mo agoYou do realize what servers do in parallel right? Async/await allows ASP.NET to scale beyond 1 thread per request.
- groundzeros2015 6mo agoAre you going to put multiple customer’s data in the same OS process? Did you know you can get even more performance if you manually manage memory and don’t use virtual functions?
- jandrewrogers 6mo agoYes, and it is extremely expensive. This is a well-known design problem in database engines. The computational cost of context-switching threads at yield points is often many times higher than the actual workload executed between yield points. To address this you either need fewer yield points, which reduces concurrency, or you need to greatly reduce the cost of yielding. An async architecture reduces the cost of yielding by multiple orders of magnitude relative to threads.
- andriy_koval 6mo ago> The computational cost of context-switching threads at yield points is often many times higher than the actual workload executed between yield points. I would they this often is 1% of cases. As for Rust ecosystem, it doesn't make much case to add so much complexity and inconvenient abstractions to cover 1% of use-cases.
- jandrewrogers 6mo agoIt approaches 100% of cases for systems that care about software performance, since software performance is bandwidth bound. If almost everyone agrees that software performance is optimally fast already then I agree with you.
- andriy_koval 6mo agoThere is perfect performance and there is performance good enough, which is 99% of cases, where adding complexity is not justified.